Numbers in base 10 that are palindromic in bases 2 4 and 16
put "{+$_} such numbers:\n", .batch(10)».fmt('%5d').join("\n") given
(^25000).grep: -> $n { all (2,4,16).map: { $n.base($_) eq $n.base($_).flip } }
Output:
23 such numbers:
0 1 3 5 15 17 51 85 255 257
273 771 819 1285 1365 3855 4095 4097 4369 12291
13107 20485 21845
PreviousNumbers in base-16 representation that cannot be written with decimal digitsNextNumbers k such that the last letter of k is the same as the first letter of k 1
Last updated
Was this helpful?