Jump to content

Numbers in base 10 that are palindromic in bases 2, 4, and 16: Difference between revisions

Add Seed7
(Add Cowgol)
(Add Seed7)
Line 478:
Found 22 numbers
done...
</pre>
 
=={{header|Seed7}}==
<lang seed7>$ include "seed7_05.s7i";
 
const func boolean: palindrome (in string: input) is
return input = reverse(input);
 
const proc: main is func
local
var integer: n is 1;
begin
write("0 ");
for n range 1 to 24999 step 2 do
if palindrome(n radix 2) and palindrome(n radix 4) and palindrome(n radix 16) then
write(n <& " ");
end if;
end for;
end func;</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>
 
1,808

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.