Pandigital prime: Difference between revisions
Content added Content deleted
(→{{header|ALGOL 68}}: Tweaked code and added solution for digits 0..n) |
(→Algol 68: Digits 0 to n: fix comment) |
||
Line 134: | Line 134: | ||
===Digits 0 to n=== |
===Digits 0 to n=== |
||
Also uses the observations in the Factor sample - the prime we are looking for can only have 8 or 5 digits. |
Also uses the observations in the Factor sample - the prime we are looking for can only have 8 or 5 digits. |
||
<lang algol68>BEGIN # Find the largest n |
<lang algol68>BEGIN # Find the largest n+1 digit prime that contains all the digits 0..n # |
||
# As noted in the Factor sample, only 8 and 5 digit primes need be # |
# As noted in the Factor sample, only 8 and 5 digit primes need be # |
||
# considered: 10 is not prime, all 3, 4, 6, 7 and 9 digit # |
# considered: 10 is not prime, all 3, 4, 6, 7 and 9 digit # |
||
# pandigital numbers are divisible by 3 # |
# pandigital numbers are divisible by 3 # |
||
# insert the common code here # |
# insert the common code here # |
||
# first try an 8 digit number then a 5 digit number if we can't find an 8 digit one # |
# first try an 8 digit number then a 5 digit number if we can't find an 8 digit one # |