Python Source Code

# Author: Hannes du Plooy
# Date: 8 October 2013
# Objective: To solve the following
#  ONE
#  ONE
#  ONE
# +ONE
# ----
#  TEN

done = False

for O in range(1,10):
    for E in range(0,10):
        if O != E:
            tmp = 4*E
            carry = tmp // 10
            N = tmp % 10
            if N == O or N == E:
                continue
            tmp = carry + 4*N
            carry = tmp // 10
            E2 = tmp % 10
            if E2 != E:
                continue
            T = carry + 4*O
            if T>=10:
                continue
            if T == O or T == E or T == N:
                continue

            print("Answer is:")
            print("")
            print(" " + str(O) + str(N) + str(E))
            print(" " + str(O) + str(N) + str(E))
            print(" " + str(O) + str(N) + str(E))
            print("+" + str(O) + str(N) + str(E))
            print("----")
            print(" " + str(T) + str(E) + str(N))
            done = True
            break
    if done:
        break