Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Write FORTRAN90 programs for the following programming exercises;

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

Here, Fj is the j th -term of the Fibonacci series, Fj = 1, 1, 2, 3, 5, 8, 13, 21, . . . where, j = 1, 2, 3, 4, 5, 6 . . ..


Take the true value of pi and plot the difference between two values as a function of number of terms. And
give your comments about the behaviour.

Prog. Exercise 3. Generate Pascal’s triangle as shown below,

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

You might also like