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 23:21, 24 June 2021
, 2 years agoAdded Perl
Not a robot (talk | contribs) (Add COBOL) |
SqrtNegInf (talk | contribs) (Added Perl) |
||
Line 333:
Found 23 such numbers.
</pre>
=={{header|Perl}}==
{{libheader|ntheory}}
<lang perl>use strict;
use warnings;
use ntheory 'todigitstring';
sub pb { my $s = todigitstring(shift,shift); return $s eq join '', reverse split '', $s }
pb($_,2) and pb($_,4) and pb($_,16) and print "$_ " for 1..25000;</lang>
{{out}}
<pre>1 3 5 15 17 51 85 255 257 273 771 819 1285 1365 3855 4095 4097 4369 12291 13107 20485 21845</pre>
=={{header|Phix}}==
|