Professional Documents
Culture Documents
prog-exe-1
prog-exe-1
Prog. Exercise 1. Take two integers as input and find out whether they are a pair of Amicable numbers.
Two numbers a and b make an Amicable number pair, if D(a) = b and D(b) = a. Here, D(n) is the sum of
all the proper divisors of the number n. For example, Let’s take two numbers, a = 220 and b = 284. Now,
D(220) = 1 + 2 + 4 + 5 + 10 + 11 + 20 + 22 + 44 + 55 + 110 = 284 and D(284) = 1 + 2 + 4 + 71 + 142 = 220.
Prog. Exercise 2. Calculate the value of π by summing the first N terms of the following series involving
Fibonacci numbers;
N
π X 1
= arctan
4 I=1
F2I+1
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1