Palindromic primes: Difference between revisions

Content added Content deleted
(Added Algol 68)
Line 22: Line 22:
FOR n TO 9 DO IF prime[ n ] THEN print( ( " ", whole( n, 0 ) ) ) FI OD;
FOR n TO 9 DO IF prime[ n ] THEN print( ( " ", whole( n, 0 ) ) ) FI OD;
# the only palindromic 2 digit numbers are multiples of 11 #
# the only palindromic 2 digit numbers are multiples of 11 #
# so 11 is the only 2 digit palindromic prime #
# so 11 is the only possible 2 digit palindromic prime #
print( ( " 11" ) );
IF prime[ 11 ] THEN print( ( " 11" ) ) FI;
# three digit numbers, the first and last digits must be odd #
# three digit numbers, the first and last digits must be odd #
# and cannot be 5 (as the number would be divisible by 5) #
# and cannot be 5 (as the number would be divisible by 5) #