Numbers in base 10 that are palindromic in bases 2, 4, and 16: Difference between revisions
Content added Content deleted
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: | 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 |
0 1 3 5 15 17 51 85 255 257 273 771 819 1285 1365 3855 4095 4097 4369 12291 13107 20485 21845 |
||
</pre> |
</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}}== |
=={{header|BCPL}}== |