Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
15
Task/Fusc-sequence/Zkl/fusc-sequence.zkl
Normal file
15
Task/Fusc-sequence/Zkl/fusc-sequence.zkl
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
fuscs:=List.createLong(1_000_000, 0); fuscs[1]=1; // we'll just use a big count
|
||||
foreach n in ([2..fuscs.len()-1]){ // and generate
|
||||
fuscs[n]=( if(n.isEven()) fuscs[n/2] else fuscs[(n-1)/2] + fuscs[(n+1)/2] )
|
||||
}
|
||||
|
||||
println("First 61 terms of the Stern-Brocot sequence:");
|
||||
fuscs[0,61].concat(" ").println();
|
||||
|
||||
println("\nIndex and value for first term longer than any previous:");
|
||||
println(" Index : Value");
|
||||
prevMax:=-1;
|
||||
foreach n in (fuscs.len()){
|
||||
f,fd := fuscs[n], f.numDigits;
|
||||
if(fd>prevMax){ println("%15,d : %,d".fmt(n,f)); prevMax=fd }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue