14 lines
546 B
Plaintext
14 lines
546 B
Plaintext
module Fusc_sequence (max as long) {
|
|
long n, max_len=-1, m
|
|
string fmt="#,##0", fs="{0:-10} : {1}"
|
|
dim f(0 to max) as long
|
|
f(0)=0, 1
|
|
for n=2 To max{If binary.and(n,1) Then f(n)=f((n-1)/2)+f((n+1)/2) else f(n)=f(n/2)}
|
|
print "First 61 terms:"
|
|
print "["+f()#slice(0,60)#str$(", ")+"]"
|
|
print "Points in the sequence where an item has more digits than any previous items:"
|
|
print format$(fs, "index", "value")
|
|
for n=0 to max{if f(n)>=max_len then m++:max_len=10&**m:print format$(fs,str$(n,fmt),str$(f(n),fmt)):refresh}
|
|
}
|
|
Fusc_sequence 700000
|