Data update
This commit is contained in:
parent
52a6ef48dd
commit
157b70a810
604 changed files with 14253 additions and 2100 deletions
40
Task/Fusc-sequence/FutureBasic/fusc-sequence.basic
Normal file
40
Task/Fusc-sequence/FutureBasic/fusc-sequence.basic
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
_max = 20000000
|
||||
|
||||
begin globals
|
||||
NSUInteger f(_max)
|
||||
end globals
|
||||
|
||||
void local fn Fusc
|
||||
f(0) = 0 : f(1) = 1
|
||||
for NSUInteger n = 2 to _max
|
||||
if ( n & 1 )
|
||||
f(n) = f((n - 1) / 2) + f((n + 1) / 2)
|
||||
else
|
||||
f(n) = f(n / 2)
|
||||
end if
|
||||
next
|
||||
end fn
|
||||
|
||||
void local fn DoIt
|
||||
NSUInteger i, d = 0
|
||||
|
||||
fn Fusc
|
||||
|
||||
for i = 0 to 60
|
||||
print f(i);" ";
|
||||
if ( i == 32 ) then print
|
||||
next
|
||||
|
||||
print : print : print @" index\t\t value"
|
||||
for i = 0 to _max
|
||||
if ( f(i) >= d )
|
||||
printf @"%11lu\t\t%6lu",i,f(i)
|
||||
if ( d == 0 ) then d = 1
|
||||
d *= 10
|
||||
end if
|
||||
next
|
||||
end fn
|
||||
|
||||
fn DoIt
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue