Given a natural number n, calculate the sum:
1² + 2² + … + n²
Compute N! (factorial of N) — the product of all natural numbers from 1 to N.
N! = 1 × 2 × 3 × … × N
Write a program that calculates 2^N.
The use of the exponentiation operator is forbidden.
Given natural numbers n and k, compute the value of the binomial coefficient:
C(n, k) = n! / (k! × (n − k)!)
Given a real number a and a natural number n, compute the sum:
1 + a + a² + … + aⁿ
You are not allowed to use the formula for the sum of a geometric progression or the exponentiation operator.
The program’s running time must be proportional to n.
Given a number n, compute the sum:
1 + 1/2² + 1/3² + … + 1/n²
Given a number n, compute the sum:
4 × (1 − 1/3 + 1/5 − 1/7 + … + (−1)ⁿ / (2n+1))
Given a natural number N, compute the sum:
1 + 2 + 2² + 2³ + … + 2^N
The use of the exponentiation operator is forbidden.