Jump to content

Pandigital prime: Difference between revisions

(→‎{{header|ALGOL 68}}: Tweaked code and added solution for digits 0..n)
Line 134:
===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.
<lang algol68>BEGIN # Find the largest n-+1 digit prime that contains all the digits 10..n #
# 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 #
# pandigital numbers are divisible by 3 #
# 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 #
3,038

edits

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