We wish to compute fib(7)
.
This is a FRACTRAN program for computing any Fibonacci number: 17/65
, 133/34
, 17/19
, 23/17
, 2233/69
, 23/29
, 31/23
, 74/341
, 31/37
, 41/31
, 129/287
, 41/43
, 13/41
, 1/13
, 1/3
.
The seed n is computed n = 78 * 5^(x - 1)
. Therefore, we start with n = 78 * 5^(7-1)
, which is 1,218,750.
- The first fraction in the program is 17/65. 1,218,750 multiplied by 17/65 is 318,750, so we replace 1,218,750 with 318,750 and begin again.
- The first fraction in the program is 17/65. 318,750 leaves a remainder when divided by 65, so we move on.
- The next fraction in the program is 133/34. 318,750 multiplied by 133/34 is 1,246,875, so we replace 318,750 with 1,246,875 and begin again.
- The first fraction in the program is 17/65. 1,246,875 leaves a remainder when divided by 65, so we move on.