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

Content added Content deleted
(→‎{{header|REXX}}: updated with an optimized version that skips all of the even integers (except zero).)
m (→‎{{header|REXX}}: added programming notes about the speed increase.)
Line 159: Line 159:
<br>function) &nbsp; because they are much faster).
<br>function) &nbsp; because they are much faster).


This REXX version takes advantage that no even integers need be tested &nbsp; (except for the single exception: &nbsp; zero).
This REXX version takes advantage that no even integers need be tested &nbsp; (except for the single exception: &nbsp; zero),
<br>this makes the execution twice as fast.
<lang rexx>/*REXX pgm finds non─neg integers that are palindromes in base 2, 4, and 16, where N<25k*/
<lang rexx>/*REXX pgm finds non─neg integers that are palindromes in base 2, 4, and 16, where N<25k*/
numeric digits 100 /*ensure enough dec. digs for large #'s*/
numeric digits 100 /*ensure enough dec. digs for large #'s*/