Numbers in base 10 that are palindromic in bases 2, 4, and 16: Difference between revisions
Numbers in base 10 that are palindromic in bases 2, 4, and 16 (view source)
Revision as of 22:03, 24 June 2021
, 2 years agoAdd BASIC
Not a robot (talk | contribs) (→{{header|BCPL}}: start from 0 rather than 1 like the others) |
Not a robot (talk | contribs) (Add BASIC) |
||
Line 61:
0 1 3 5 15 17 51 85 255 257 273 771 819 1285 1365 3855 4095 4097 4369 12291 13107 20485 21845
</pre>
=={{header|BASIC}}==
<lang basic>10 DEFINT A-Z: DEFDBL R
20 FOR I=1 TO 25000
30 B=2: GOSUB 100: IF R<>I GOTO 70
40 B=4: GOSUB 100: IF R<>I GOTO 70
50 B=16: GOSUB 100: IF R<>I GOTO 70
60 PRINT I,
70 NEXT
80 END
100 R=0: N=I
110 IF N=0 THEN RETURN
120 R=R*B+N MOD B
130 N=N\B
140 GOTO 110</lang>
{{out}}
<pre> 0 1 3 5 15
17 51 85 255 257
273 771 819 1285 1365
3855 4095 4097 4369 12291
13107 20485 21845</pre>
=={{header|BCPL}}==
|