This Python program reads an integer n and computes the result of the following series:
∑ [√k / k + k! / k²] for k from 1 to n
It uses math.sqrt and math.factorial for accurate computation.
import math
def compute_series(n: int) -> float:
total = 0.0
for k in range(1, n + 1):
root_term = math.sqrt(k) / k
factorial_term = math.factorial(k) / (k ** 2)
total += root_term + factorial_term
return total
# Read input from user
n = int(input("Enter value for n: "))
result = compute_series(n)
print(f"Series result is: {result:.4f}")
Series result is: 3.6111