Numbers in base 10 that are palindromic in bases 2, 4, and 16: Difference between revisions
Content added Content deleted
(Added solution for Action!) |
Alextretyak (talk | contribs) (Added 11l) |
||
Line 4: | Line 4: | ||
<br><br> |
<br><br> |
||
=={{header|11l}}== |
|||
{{trans|Python}} |
|||
<lang 11l>F reverse(=n, base) |
|||
V r = 0 |
|||
L n > 0 |
|||
r = r * base + n % base |
|||
n I/= base |
|||
R r |
|||
F palindrome(n, base) |
|||
R n == reverse(n, base) |
|||
V cnt = 0 |
|||
L(i) 25000 |
|||
I all((2, 4, 16).map(base -> palindrome(@i, base))) |
|||
cnt++ |
|||
print(‘#5’.format(i), end' " \n"[cnt % 12 == 0]) |
|||
print()</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|Action!}}== |
=={{header|Action!}}== |