Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Fusc-sequence/XPL0/fusc-sequence.xpl0
Normal file
29
Task/Fusc-sequence/XPL0/fusc-sequence.xpl0
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
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);
|
||||
];
|
||||
];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue