Fusc sequence: Difference between revisions
Content deleted Content added
m →{{header|Wren}}: Minor tidy |
No edit summary |
||
Line 723: | Line 723: | ||
next n |
next n |
||
end subroutine</syntaxhighlight> |
end subroutine</syntaxhighlight> |
||
=={{header|BBC BASIC}}== |
|||
{{works with|BBC BASIC for Windows}} |
|||
<syntaxhighlight lang="bbcbasic"> DIM Idx%(4) |
|||
L%=1 |
|||
F%=FNfusc(I%) |
|||
PRINT "First 61 numbers:" |
|||
WHILE L% < 5 |
|||
IF I% < 61 PRINT;F% ","; |
|||
I%+=1 |
|||
F%=FNfusc(I%) |
|||
IF LOGF% > L% Idx%(L%)=I% : L%+=1 |
|||
ENDIF |
|||
ENDWHILE |
|||
PRINT CHR$127 ''"Number of digits in sequence increase at:" |
|||
FOR I%=0 TO L%-1 |
|||
PRINT ;Idx%(I%) ",";FNfusc(Idx%(I%)) |
|||
NEXT |
|||
END |
|||
DEF FNfusc(n%) |
|||
IF n% < 2 THEN =n% |
|||
IF n% AND 1 THEN =FNfusc((n%-1)/2) + FNfusc((n%+1)/2) |
|||
=FNfusc(n%/2)</syntaxhighlight> |
|||
{{out}} |
|||
<pre>First 61 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 |
|||
Number of digits in sequence increase at: |
|||
0,0 |
|||
37,11 |
|||
1173,108 |
|||
35499,1076 |
|||
699051,10946</pre> |
|||
=={{header|BQN}}== |
=={{header|BQN}}== |