Part of the series

Several example codes

~1 min read • Updated Oct 13, 2025

Program Overview

This Python program reads an integer n and computes the result of the following series:
∑ [√(2k + 1) / (k³ + k)²] for k from 2 to n
It uses math.sqrt for accurate square root calculations.


Python Code:


import math

def compute_series(n: int) -> float:
    total = 0.0
    for k in range(2, n + 1):
        numerator = math.sqrt(2 * k + 1)
        denominator = (k ** 3 + k) ** 2
        total += numerator / denominator
    return total

# Read input from user
n = int(input("Enter value for n: "))
result = compute_series(n)
print(f"Series result is: {result:.6f}")

Sample Output (input: n = 4):


Series result is: 0.000271

Written & researched by Dr. Shahin Siami