Fusc sequence: Difference between revisions

Content added Content deleted
Line 993: Line 993:
const N_FIRST=61;
const N_FIRST=61;
const MAX_N_DIGITS=6;
const MAX_N_DIGITS=6;
foreach( n; 0..N_FIRST )
n.fusc.format!"%d ".write;
format!"First %d fusc numbers: "(N_FIRST).write;
writeln;
foreach( n; 0..N_FIRST ) n.fusc.format!"%d ".write;
writeln;
for(int n=0, ndigits=0; ndigits<MAX_N_DIGITS; n++)
format!"First fusc number for each number of digits (1 to %d digits):"(MAX_N_DIGITS).writeln;
for(auto n=0, ndigits=0; ndigits<MAX_N_DIGITS; n++)
if( n.fusc.to!string.length > ndigits ){
if( n.fusc.to!string.length > ndigits ){
format!"%d: %d"( n, n.fusc ).writeln;
format!"fusc(%d)=%d"( n, n.fusc ).writeln;
ndigits = n.fusc.to!string.length.to!int;
ndigits = n.fusc.to!string.length.to!int;
}
}
}</lang>
}</lang>
{{out}}
{{out}}
<pre>0 1 1 2 1 3 2 3 1 4 3 5 2 5 3 4 1 5 4 7 3 8 5 7 2 7 5 8 3 7 4 5 1 6 5 9 4 11 7 10 3 11 8 13 5 12 7 9 2 9 7 12 5 13 8 11 3 10 7 11 4
<pre>First 61 fusc numbers: 0 1 1 2 1 3 2 3 1 4 3 5 2 5 3 4 1 5 4 7 3 8 5 7 2 7 5 8 3 7 4 5 1 6 5 9 4 11 7 10 3 11 8 13 5 12 7 9 2 9 7 12 5 13 8 11 3 10 7 11 4
First fusc number for each number of digits (1 to 6 digits):
0: 0
fusc(0)=0
37: 11
fusc(37)=11
1173: 108
fusc(1173)=108
35499: 1076
fusc(35499)=1076
699051: 10946
fusc(699051)=10946
19573419: 103682</pre>
fusc(19573419)=103682</pre>


=={{header|Delphi}}==
=={{header|Delphi}}==