This Python program reads an integer n and computes the result of the following series:
∑ [k(k+1)(k+2) / (n+k)(n+k+1)(n+k+2)] for k from 1 to n
Each term involves a product of three consecutive integers in both numerator and denominator.
def compute_series(n: int) -> float:
total = 0.0
for k in range(1, n + 1):
numerator = k * (k + 1) * (k + 2)
denominator = (n + k) * (n + k + 1) * (n + 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}")
Series result is: 0.317460