Onze=11111
Nbr=1000000000
# find first multiple of 11111
# ie increment NBr by 1 and stop when you have a multiple of 11111
# ie reminder of Nbr didided by 11111=0
R=None
while R!=0:
R=Nbr%Onze
Nbr+=1
# FirstNbr is the first multiple of 11111 with 10 digits
CurrentMultiple=Nbr-1
print(CurrentMultiple) # print first multiple
Solutions=[] # make a list to store solutions
# now we will scan all multiples and see if they fulfill the ABCDEFGHIJ constraint
SolCount=0 # SolCount will count the solutions
while CurrentMultiple<10000000000:
# check if all digits are differrebnt
digits=set() # create a python set to store digits
for d in str(CurrentMultiple): # put all digits in the set"
digits.add(d)
if len(digits)==10: # if the length of the set is equal to 10, all digits are different
SolCount+=1 # so we have a new solution
Solutions.append(CurrentMultiple)
print(CurrentMultiple)
CurrentMultiple+=Onze
print(SolCount) # print Count of Solutions
Solutions.sort() # sort list of solutions
print(len(Solutions))
print(Solutions) # print Solutions
|
Posted by jcbar
on 2019-07-20 15:53:26 |