Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 614 Bytes

970.md

File metadata and controls

31 lines (22 loc) · 614 Bytes

Python script:

cardno="543210******1234"
poss=[]

for temp in range(10**6):
    s = str(temp).zfill(6)
    num = cardno[0:6]+s+cardno[12:16]

    if int(num) % 123457 == 0:
        poss.append(num)

# print(poss)

weights = [2 if i%2==0 else 1 for i in range(16)]
# print(weights)

def sum_of_digits(n):
    return sum(int(digit) for digit in str(n))

for num in poss:
    numl = list(num)
    luhn = [sum_of_digits(int(num[i])*weights[i]) for i in range(16)]
    # print(sum(luhn))
    if(sum(luhn)%10==0):
        print(num)