import itertools #Ten unused letters: abcdjkmpqz #Sixteen used letters: efghilnorstuvwxy thewords = ('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty', 'twentyone', 'twentytwo', 'twentythree', 'twentyfour', 'twentyfive', 'twentysix') thenums = range(27)[1:] def wordsum(word): result = 0 for char in word: result = result + eval(char) return result #Took away the distinct requirement here. As we'll see, not even that affords a solution. #This first list takes about 10 minutes to create. It's copied at the end of this file. everything = itertools.product(thenums,repeat=5) efint = [] for thing in everything: itworks = True e,f,i,n,t = thing for counter in [19, 15, 10, 9]: if wordsum(thewords[counter-1])%counter != 0: itworks = False break if itworks: print thing efint = efint + [list(thing)] print "Adding v" efintv = [] for thing in efint: e,f,i,n,t = thing for v in thenums: if wordsum("five")%5 == 0: newthing = list(thing) + [v] print newthing efintv = efintv + [list(newthing)] print "Adding s" efintvs = [] for thing in efintv: e,f,i,n,t,v = thing for s in thenums: if (wordsum("seven")%7 == 0) & (wordsum("seventeen")%17 == 0): newthing = list(thing) + [s] print newthing efintvs = efintvs + [list(newthing)] #291 solutions. print "Adding x" efintvsx = [] for thing in efintvs: e,f,i,n,t,v,s = thing for x in thenums: if (wordsum("six")%6 == 0) & (wordsum("sixteen")%16 == 0): newthing = list(thing) + [x] print newthing efintvsx = efintvsx + [list(newthing)] print "Adding l" efintvsxl = [] for thing in efintvsx: e,f,i,n,t,v,s,x = thing for l in thenums: if wordsum("eleven")%11 == 0: newthing = list(thing) + [l] print newthing efintvsxl = efintvsxl + [list(newthing)] #233 solutions. print "Adding w" efintvsxlw = [] for thing in efintvsxl: e,f,i,n,t,v,s,x,l = thing for w in thenums: if wordsum("twelve")%12 == 0: newthing = list(thing) + [w] print newthing efintvsxlw = efintvsxlw + [list(newthing)] #493 solutions. print "Adding y" efintvsxlwy = [] for thing in efintvsxlw: e,f,i,n,t,v,s,x,l,w = thing for y in thenums: if (wordsum("twenty")%20 == 0) & (wordsum("twentyfive")%25 == 0) & (wordsum("twentysix")%26 == 0): newthing = list(thing) + [y] print newthing efintvsxlwy = efintvsxlwy + [list(newthing)] #20 solutions. print "Adding o" efintvsxlwyo = [] for thing in efintvsxlwy: e,f,i,n,t,v,s,x,l,w,y = thing for o in thenums: if (wordsum("twentyone")%21 == 0) & (wordsum("twentytwo")%22 == 0): newthing = list(thing) + [o] print newthing efintvsxlwyo = efintvsxlwyo + [list(newthing)] #Only THREE solutions emerge so far: #efintvsxlwyo = [[10, 17, 21, 7, 23, 2, 6, 3, 5, 22, 15, 9], [10, 18, 19, 8, 22, 3, 4, 7, 3, 24, 14, 8], [10, 19, 17, 9, 21, 4, 2, 11, 1, 26, 13, 7]] print "Adding h,r" efintvsxlwyohr = [] for thing in efintvsxlwyo: e,f,i,n,t,v,s,x,l,w,y,o = thing for h in thenums: for r in thenums: if (wordsum("three")%3 == 0) & (wordsum("thirteen")%13 == 0) & (wordsum("twentythree")%23 == 0): newthing = list(thing) + [h,r] print newthing efintvsxlwyohr = efintvsxlwyohr + [list(newthing)] #No solutions given. If indistinct values won't work, neither will distinct values. #efint = [[1, 1, 7, 14, 5], [1, 1, 12, 16, 13], [1, 1, 17, 18, 21], [1, 2, 5, 15, 4], [1, 2, 10, 17, 12], [1, 2, 15, 19, 20], [1, 3, 3, 16, 3], [1, 3, 8, 18, 11], [1, 3, 13, 20, 19], [1, 4, 1, 17, 2], [1, 4, 6, 19, 10], [1, 4, 11, 21, 18], [1, 4, 16, 23, 26], [1, 5, 4, 20, 9], [1, 5, 9, 22, 17], [1, 5, 14, 24, 25], [1, 5, 24, 1, 8], [1, 6, 2, 21, 8], [1, 6, 7, 23, 16], [1, 6, 12, 25, 24], [1, 6, 22, 2, 7], [1, 7, 5, 24, 15], [1, 7, 10, 26, 23], [1, 7, 20, 3, 6], [1, 7, 25, 5, 14], [1, 8, 3, 25, 14], [1, 8, 18, 4, 5], [1, 8, 23, 6, 13], [1, 9, 1, 26, 13], [1, 9, 16, 5, 4], [1, 9, 21, 7, 12], [1, 9, 26, 9, 20], [1, 10, 14, 6, 3], [1, 10, 19, 8, 11], [1, 10, 24, 10, 19], [1, 11, 12, 7, 2], [1, 11, 17, 9, 10], [1, 11, 22, 11, 18], [1, 12, 10, 8, 1], [1, 12, 15, 10, 9], [1, 12, 20, 12, 17], [1, 12, 25, 14, 25], [1, 13, 13, 11, 8], [1, 13, 18, 13, 16], [1, 13, 23, 15, 24], [1, 14, 11, 12, 7], [1, 14, 16, 14, 15], [1, 14, 21, 16, 23], [1, 15, 9, 13, 6], [1, 15, 14, 15, 14], [1, 15, 19, 17, 22], [1, 16, 7, 14, 5], [1, 16, 12, 16, 13], [1, 16, 17, 18, 21], [1, 17, 5, 15, 4], [1, 17, 10, 17, 12], [1, 17, 15, 19, 20], [1, 18, 3, 16, 3], [1, 18, 8, 18, 11], [1, 18, 13, 20, 19], [1, 19, 1, 17, 2], [1, 19, 6, 19, 10], [1, 19, 11, 21, 18], [1, 19, 16, 23, 26], [1, 20, 4, 20, 9], [1, 20, 9, 22, 17], [1, 20, 14, 24, 25], [1, 20, 24, 1, 8], [1, 21, 2, 21, 8], [1, 21, 7, 23, 16], [1, 21, 12, 25, 24], [1, 21, 22, 2, 7], [1, 22, 5, 24, 15], [1, 22, 10, 26, 23], [1, 22, 20, 3, 6], [1, 22, 25, 5, 14], [1, 23, 3, 25, 14], [1, 23, 18, 4, 5], [1, 23, 23, 6, 13], [1, 24, 1, 26, 13], [1, 24, 16, 5, 4], [1, 24, 21, 7, 12], [1, 24, 26, 9, 20], [1, 25, 14, 6, 3], [1, 25, 19, 8, 11], [1, 25, 24, 10, 19], [1, 26, 12, 7, 2], [1, 26, 17, 9, 10], [1, 26, 22, 11, 18], [2, 1, 11, 25, 3], [2, 2, 9, 26, 2], [2, 6, 26, 13, 5], [2, 7, 24, 14, 4], [2, 8, 22, 15, 3], [2, 9, 20, 16, 2], [2, 9, 25, 18, 10], [2, 10, 18, 17, 1], [2, 10, 23, 19, 9], [2, 11, 21, 20, 8], [2, 11, 26, 22, 16], [2, 12, 19, 21, 7], [2, 12, 24, 23, 15], [2, 13, 17, 22, 6], [2, 13, 22, 24, 14], [2, 14, 15, 23, 5], [2, 14, 20, 25, 13], [2, 15, 13, 24, 4], [2, 15, 18, 26, 12], [2, 16, 11, 25, 3], [2, 17, 9, 26, 2], [2, 21, 26, 13, 5], [2, 22, 24, 14, 4], [2, 23, 22, 15, 3], [2, 24, 20, 16, 2], [2, 24, 25, 18, 10], [2, 25, 18, 17, 1], [2, 25, 23, 19, 9], [2, 26, 21, 20, 8], [2, 26, 26, 22, 16], [3, 8, 26, 26, 1], [3, 23, 26, 26, 1], [9, 7, 7, 1, 20], [9, 8, 5, 2, 19], [9, 9, 3, 3, 18], [9, 9, 8, 5, 26], [9, 10, 1, 4, 17], [9, 10, 6, 6, 25], [9, 11, 4, 7, 24], [9, 12, 2, 8, 23], [9, 22, 7, 1, 20], [9, 23, 5, 2, 19], [9, 24, 3, 3, 18], [9, 24, 8, 5, 26], [9, 25, 1, 4, 17], [9, 25, 6, 6, 25], [9, 26, 4, 7, 24], [10, 1, 3, 25, 25], [10, 1, 13, 2, 8], [10, 1, 18, 4, 16], [10, 1, 23, 6, 24], [10, 2, 1, 26, 24], [10, 2, 11, 3, 7], [10, 2, 16, 5, 15], [10, 2, 21, 7, 23], [10, 3, 9, 4, 6], [10, 3, 14, 6, 14], [10, 3, 19, 8, 22], [10, 4, 7, 5, 5], [10, 4, 12, 7, 13], [10, 4, 17, 9, 21], [10, 5, 5, 6, 4], [10, 5, 10, 8, 12], [10, 5, 15, 10, 20], [10, 6, 3, 7, 3], [10, 6, 8, 9, 11], [10, 6, 13, 11, 19], [10, 7, 1, 8, 2], [10, 7, 6, 10, 10], [10, 7, 11, 12, 18], [10, 7, 16, 14, 26], [10, 8, 4, 11, 9], [10, 8, 9, 13, 17], [10, 8, 14, 15, 25], [10, 9, 2, 12, 8], [10, 9, 7, 14, 16], [10, 9, 12, 16, 24], [10, 10, 5, 15, 15], [10, 10, 10, 17, 23], [10, 11, 3, 16, 14], [10, 11, 8, 18, 22], [10, 12, 1, 17, 13], [10, 12, 6, 19, 21], [10, 13, 4, 20, 20], [10, 13, 24, 1, 19], [10, 14, 2, 21, 19], [10, 14, 22, 2, 18], [10, 15, 5, 24, 26], [10, 15, 15, 1, 9], [10, 15, 20, 3, 17], [10, 15, 25, 5, 25], [10, 16, 3, 25, 25], [10, 16, 13, 2, 8], [10, 16, 18, 4, 16], [10, 16, 23, 6, 24], [10, 17, 1, 26, 24], [10, 17, 11, 3, 7], [10, 17, 16, 5, 15], [10, 17, 21, 7, 23], [10, 18, 9, 4, 6], [10, 18, 14, 6, 14], [10, 18, 19, 8, 22], [10, 19, 7, 5, 5], [10, 19, 12, 7, 13], [10, 19, 17, 9, 21], [10, 20, 5, 6, 4], [10, 20, 10, 8, 12], [10, 20, 15, 10, 20], [10, 21, 3, 7, 3], [10, 21, 8, 9, 11], [10, 21, 13, 11, 19], [10, 22, 1, 8, 2], [10, 22, 6, 10, 10], [10, 22, 11, 12, 18], [10, 22, 16, 14, 26], [10, 23, 4, 11, 9], [10, 23, 9, 13, 17], [10, 23, 14, 15, 25], [10, 24, 2, 12, 8], [10, 24, 7, 14, 16], [10, 24, 12, 16, 24], [10, 25, 5, 15, 15], [10, 25, 10, 17, 23], [10, 26, 3, 16, 14], [10, 26, 8, 18, 22], [11, 1, 17, 13, 6], [11, 1, 22, 15, 14], [11, 2, 15, 14, 5], [11, 2, 20, 16, 13], [11, 2, 25, 18, 21], [11, 3, 13, 15, 4], [11, 3, 18, 17, 12], [11, 3, 23, 19, 20], [11, 4, 11, 16, 3], [11, 4, 16, 18, 11], [11, 4, 21, 20, 19], [11, 5, 9, 17, 2], [11, 5, 14, 19, 10], [11, 5, 19, 21, 18], [11, 5, 24, 23, 26], [11, 6, 7, 18, 1], [11, 6, 12, 20, 9], [11, 6, 17, 22, 17], [11, 6, 22, 24, 25], [11, 7, 10, 21, 8], [11, 7, 15, 23, 16], [11, 7, 20, 25, 24], [11, 8, 8, 22, 7], [11, 8, 13, 24, 15], [11, 8, 18, 26, 23], [11, 9, 6, 23, 6], [11, 9, 11, 25, 14], [11, 9, 26, 4, 5], [11, 10, 4, 24, 5], [11, 10, 9, 26, 13], [11, 10, 24, 5, 4], [11, 11, 2, 25, 4], [11, 11, 22, 6, 3], [11, 12, 20, 7, 2], [11, 12, 25, 9, 10], [11, 13, 18, 8, 1], [11, 13, 23, 10, 9], [11, 14, 21, 11, 8], [11, 14, 26, 13, 16], [11, 15, 19, 12, 7], [11, 15, 24, 14, 15], [11, 16, 17, 13, 6], [11, 16, 22, 15, 14], [11, 17, 15, 14, 5], [11, 17, 20, 16, 13], [11, 17, 25, 18, 21], [11, 18, 13, 15, 4], [11, 18, 18, 17, 12], [11, 18, 23, 19, 20], [11, 19, 11, 16, 3], [11, 19, 16, 18, 11], [11, 19, 21, 20, 19], [11, 20, 9, 17, 2], [11, 20, 14, 19, 10], [11, 20, 19, 21, 18], [11, 20, 24, 23, 26], [11, 21, 7, 18, 1], [11, 21, 12, 20, 9], [11, 21, 17, 22, 17], [11, 21, 22, 24, 25], [11, 22, 10, 21, 8], [11, 22, 15, 23, 16], [11, 22, 20, 25, 24], [11, 23, 8, 22, 7], [11, 23, 13, 24, 15], [11, 23, 18, 26, 23], [11, 24, 6, 23, 6], [11, 24, 11, 25, 14], [11, 24, 26, 4, 5], [11, 25, 4, 24, 5], [11, 25, 9, 26, 13], [11, 25, 24, 5, 4], [11, 26, 2, 25, 4], [11, 26, 22, 6, 3], [12, 1, 21, 24, 4], [12, 1, 26, 26, 12], [12, 2, 19, 25, 3], [12, 3, 17, 26, 2], [12, 11, 26, 17, 1], [12, 14, 25, 22, 6], [12, 15, 23, 23, 5], [12, 16, 21, 24, 4], [12, 16, 26, 26, 12], [12, 17, 19, 25, 3], [12, 18, 17, 26, 2], [12, 26, 26, 17, 1], [19, 1, 4, 11, 20], [19, 2, 2, 12, 19], [19, 3, 5, 15, 26], [19, 4, 3, 16, 25], [19, 5, 1, 17, 24], [19, 8, 15, 1, 20], [19, 9, 13, 2, 19], [19, 10, 6, 1, 10], [19, 10, 11, 3, 18], [19, 10, 16, 5, 26], [19, 11, 4, 2, 9], [19, 11, 9, 4, 17], [19, 11, 14, 6, 25], [19, 12, 2, 3, 8], [19, 12, 7, 5, 16], [19, 12, 12, 7, 24], [19, 13, 5, 6, 15], [19, 13, 10, 8, 23], [19, 14, 3, 7, 14], [19, 14, 8, 9, 22], [19, 15, 1, 8, 13], [19, 15, 6, 10, 21], [19, 16, 4, 11, 20], [19, 17, 2, 12, 19], [19, 18, 5, 15, 26], [19, 19, 3, 16, 25], [19, 20, 1, 17, 24], [19, 23, 15, 1, 20], [19, 24, 13, 2, 19], [19, 25, 6, 1, 10], [19, 25, 11, 3, 18], [19, 25, 16, 5, 26], [19, 26, 4, 2, 9], [19, 26, 9, 4, 17], [19, 26, 14, 6, 25], [20, 1, 3, 20, 10], [20, 1, 8, 22, 18], [20, 1, 13, 24, 26], [20, 1, 23, 1, 9], [20, 2, 1, 21, 9], [20, 2, 6, 23, 17], [20, 2, 11, 25, 25], [20, 2, 21, 2, 8], [20, 2, 26, 4, 16], [20, 3, 4, 24, 16], [20, 3, 9, 26, 24], [20, 3, 19, 3, 7], [20, 3, 24, 5, 15], [20, 4, 2, 25, 15], [20, 4, 17, 4, 6], [20, 4, 22, 6, 14], [20, 5, 15, 5, 5], [20, 5, 20, 7, 13], [20, 5, 25, 9, 21], [20, 6, 13, 6, 4], [20, 6, 18, 8, 12], [20, 6, 23, 10, 20], [20, 7, 11, 7, 3], [20, 7, 16, 9, 11], [20, 7, 21, 11, 19], [20, 8, 9, 8, 2], [20, 8, 14, 10, 10], [20, 8, 19, 12, 18], [20, 8, 24, 14, 26], [20, 9, 7, 9, 1], [20, 9, 12, 11, 9], [20, 9, 17, 13, 17], [20, 9, 22, 15, 25], [20, 10, 10, 12, 8], [20, 10, 15, 14, 16], [20, 10, 20, 16, 24], [20, 11, 8, 13, 7], [20, 11, 13, 15, 15], [20, 11, 18, 17, 23], [20, 12, 6, 14, 6], [20, 12, 11, 16, 14], [20, 12, 16, 18, 22], [20, 13, 4, 15, 5], [20, 13, 9, 17, 13], [20, 13, 14, 19, 21], [20, 14, 2, 16, 4], [20, 14, 7, 18, 12], [20, 14, 12, 20, 20], [20, 15, 5, 19, 11], [20, 15, 10, 21, 19], [20, 16, 3, 20, 10], [20, 16, 8, 22, 18], [20, 16, 13, 24, 26], [20, 16, 23, 1, 9], [20, 17, 1, 21, 9], [20, 17, 6, 23, 17], [20, 17, 11, 25, 25], [20, 17, 21, 2, 8], [20, 17, 26, 4, 16], [20, 18, 4, 24, 16], [20, 18, 9, 26, 24], [20, 18, 19, 3, 7], [20, 18, 24, 5, 15], [20, 19, 2, 25, 15], [20, 19, 17, 4, 6], [20, 19, 22, 6, 14], [20, 20, 15, 5, 5], [20, 20, 20, 7, 13], [20, 20, 25, 9, 21], [20, 21, 13, 6, 4], [20, 21, 18, 8, 12], [20, 21, 23, 10, 20], [20, 22, 11, 7, 3], [20, 22, 16, 9, 11], [20, 22, 21, 11, 19], [20, 23, 9, 8, 2], [20, 23, 14, 10, 10], [20, 23, 19, 12, 18], [20, 23, 24, 14, 26], [20, 24, 7, 9, 1], [20, 24, 12, 11, 9], [20, 24, 17, 13, 17], [20, 24, 22, 15, 25], [20, 25, 10, 12, 8], [20, 25, 15, 14, 16], [20, 25, 20, 16, 24], [20, 26, 8, 13, 7], [20, 26, 13, 15, 15], [20, 26, 18, 17, 23], [21, 2, 25, 13, 6], [21, 3, 23, 14, 5], [21, 4, 21, 15, 4], [21, 4, 26, 17, 12], [21, 5, 19, 16, 3], [21, 5, 24, 18, 11], [21, 6, 17, 17, 2], [21, 6, 22, 19, 10], [21, 7, 15, 18, 1], [21, 7, 20, 20, 9], [21, 7, 25, 22, 17], [21, 8, 18, 21, 8], [21, 8, 23, 23, 16], [21, 9, 16, 22, 7], [21, 9, 21, 24, 15], [21, 9, 26, 26, 23], [21, 10, 14, 23, 6], [21, 10, 19, 25, 14], [21, 11, 12, 24, 5], [21, 11, 17, 26, 13], [21, 12, 10, 25, 4], [21, 13, 8, 26, 3], [21, 14, 26, 8, 1], [21, 17, 25, 13, 6], [21, 18, 23, 14, 5], [21, 19, 21, 15, 4], [21, 19, 26, 17, 12], [21, 20, 19, 16, 3], [21, 20, 24, 18, 11], [21, 21, 17, 17, 2], [21, 21, 22, 19, 10], [21, 22, 15, 18, 1], [21, 22, 20, 20, 9], [21, 22, 25, 22, 17], [21, 23, 18, 21, 8], [21, 23, 23, 23, 16], [21, 24, 16, 22, 7], [21, 24, 21, 24, 15], [21, 24, 26, 26, 23], [21, 25, 14, 23, 6], [21, 25, 19, 25, 14], [21, 26, 12, 24, 5], [21, 26, 17, 26, 13], [22, 4, 25, 26, 2], [22, 19, 25, 26, 2]]