ROSECODE 234
Programming exercise - Fractions madness
Consider the sequence of fractions:
We define the following algorithm (n is an integer):
- 10, 24, 46, ...
Find the 100th value
You are given the 20-th element: 185500
[My timing: < 100 ms]
We define the following algorithm (n is an integer):
func(n){
i = 0;
Start:
j = 0;
while (F[j]*n not integer) {
j++;
}
i++;
n = n*F[j]
if (n has only factors 2 and 3){
print(i);
}
goto Start;
}
The first values func(6) yield are:- 10, 24, 46, ...
Find the 100th value
You are given the 20-th element: 185500
[My timing: < 100 ms]