30 lines
596 B
Plaintext
30 lines
596 B
Plaintext
func IntLen(N); \Return number of digits in N
|
|
int N, L;
|
|
[L:= 0;
|
|
repeat N:= N/10;
|
|
L:= L+1;
|
|
until N = 0;
|
|
return L;
|
|
];
|
|
|
|
def Size = 1000000;
|
|
int Fusc(Size), N, Len, Max;
|
|
[Fusc(0):= 0; Fusc(1):= 1;
|
|
for N:= 2 to Size-1 do
|
|
Fusc(N):= if N&1 then Fusc((N-1)/2) + Fusc((N+1)/2) else Fusc(N/2);
|
|
for N:= 0 to 60 do
|
|
[IntOut(0, Fusc(N)); ChOut(0, ^ )];
|
|
Text(0, "
|
|
n fusc(n)
|
|
");
|
|
Max:= 0;
|
|
for N:= 0 to Size-1 do
|
|
[Len:= IntLen(Fusc(N));
|
|
if Len > Max then
|
|
[Max:= Len;
|
|
IntOut(0, N); ChOut(0, 9\tab\);
|
|
IntOut(0, Fusc(N)); CrLf(0);
|
|
];
|
|
];
|
|
]
|