Exemplo n.º 1
0
'''

import time
t = time.time()

largest = 0
for n in range(2,10):
    upper_bound = 10000 #exclusive
    lower_bound = 1
    
    if n == 2:
        lower_bound = 5000
    elif n == 3:
        upper_bound = 334
        lower_bound = 100
    else:
        upper_bound = 100
        
    for i in range(lower_bound, upper_bound):
        num = ''
        for x in range(1,n+1):
            num += str(i*x)
            
        num = int(num)
        if num > largest and cf.is_pandigital(num, 9):
            largest = num
            
print largest

print time.time() - t 
Exemplo n.º 2
0
'''
Created on 2013-01-21

@author: paymahn
'''

'''
A 1-9 pandigital product is a 2-digit number
times a 3-digit number, or a 1-digit number
times a 4-digit number, with a product less
than 1e4.  (3 2 and 4 1 also works, but don't
give any extra products.)

'''
import CommonFunctions as cf

found_number = set()



for i in range(1,100):
    for j in range(100,10000):
         num_str = str(i) + str(j) + str(i*j)
         if len(num_str) == 9 and cf.is_pandigital(int(num_str), 9):
             found_number.add(i*j)
                
print sum(found_number)
Exemplo n.º 3
0
'''
Created on 2013-01-22

@author: paymahn
'''

'''
Turns out that 9 and 8 digit pandigital numbers are always divisible by 3

'''
import CommonFunctions as cf
import math

max = 7654322

primes = cf.generate_primes_less_than(max)

for i in reversed(primes):
    if cf.is_pandigital(i, int(math.log10(i)) + 1):
        print i
        break;