Created
July 6, 2016 13:30
-
-
Save yuda110/2206fb5ced0b71b3344b334dcece9936 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
from primesieve import generate_primes | |
def get_biggest_decimal_pandigital(n): | |
max_pan = 0 | |
permu_obj = itertools.permutations(range(1, n+1)) | |
for pan in permu_obj: | |
each_pan = int(''.join(map(str,pan))) | |
if len(generate_primes(each_pan, each_pan)) > 0 and each_pan > max_pan: | |
max_pan = each_pan | |
return max_pan | |
for i in range(5, 10): | |
print(get_biggest_decimal_pandigital(i)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment