Remember
“Unique and restricted” ? ,b (pid=13696)
There I have asked for a restricted answer to an alphametic puzzle and got a set of many words.
Now I have fiddled with a similar equation and again will allow only answers not using any of the letters appearing in “TWELVE”.
TWELVE + TWELVE = (Oompha, grubby, payoff, droppy ….et al)
Your task is to find an answer to my puzzle such that adding the numerical values of all 6 letters in the word chosen by you (a long list of candidate solutions) will be closest to 24.
Start your chase.
Good luck!
We are searching for words that form the RHS of an alphametic equation with various properties.
TWELVE has 5 unique letters, there for the RHS must have 6 digits but only 5 unique ones. So our word has one digit that appears twice.
Plan:
From a word list, select 6 letter words with 5 unique letters none of which are in TWELV. I found 403 with my word list of about 46K words. These can be sorted into patterns according to which digits are identical.
Convert string of 6 letters to a 6-digit binary string with '1' in place of the letters that appear twice and '0' for any letter appearing just once.
For example, pattern('Oompha') = '110000'. So make a dictionary where the keys are the 6 digit binary patterns, and the values are lists of suitable words.
Next find numbers that might serve as the RHS.
These must be 6 digit even numbers with 5 unique digits,
and division by 2 yields another 6 digit number with 5 unique digits,
and our number and its "half value" cannot share any digits,
and it's half value (which will be the word TWELVE) must be of pattern '001001'.
Also, the sod() of our RHS number must be 24 (or 23, or 25)
--------------
Output of Program:
For sod of 23
TWELVE RHS pattern
451861 903722 000011
['ACROSS', 'BURGOO', 'BYPASS', 'KAROSS', 'KUMISS', 'MORASS', 'NARDOO', 'PAYOFF', 'RUNOFF', 'SCRUFF', 'SHROFF']
461851 923702 010001
['ABSORB', 'ARBOUR', 'ARMOUR', 'BINGHI', 'CARINA', 'CHOUGH', 'DAGOBA', 'DOMINO', 'FARINA', 'FASCIA', 'INBORN', 'INSPAN', 'MARINA', 'OMASUM', 'PAGODA', 'PONCHO', 'SYRUPY', 'UNBORN', 'UNISON']
For sod of 24
TWELVE RHS pattern
186546 373092 101000
['ABACUS', 'ACARID', 'ACARUS', 'ADAGIO', 'AGAMIC', 'AGARIC', 'AMADOU', 'AMAZON', 'ANARCH', 'ASARUM', 'CACHOU', 'COCKUP', 'IDIOCY', 'MIMOSA', 'NANOID', 'NONARY', 'NUNCIO', 'PAPISM', 'POPGUN', 'POPISH']
486516 973032 001010
['CANING', 'CHAZAN', 'FRACAS', 'FRIGID', 'GRAHAM', 'HORARY', 'ISOPOD', 'ORIGIN', 'QUASAR', 'RAISIN', 'SCARAB', 'SHAMAN', 'UNIFIC', 'UROPOD', 'ZONING']
For sod of 25
TWELVE RHS pattern
I found no solutions
--------------
def pattern(a):
""" convert string a to binary string """
a = str(a)
ans = ''
for c in a:
if a.count(c) > 1:
ans += '1'
else:
ans += '0'
return ans
wds = []
for w in words:
if len(w) != 6:
continue
if len(set(w)) != 5:
continue
if 'T' in w:
continue
if 'W' in w:
continue
if 'E' in w:
continue
if 'L' in w:
continue
if 'V' in w:
continue
wds.append(w)
wdpatterns = {}
for w in wds:
pat = pattern(w)
if pat not in wdpatterns:
wdpatterns[pat] = [w]
else:
wdpatterns[pat].append(w)
for sod_of_RHS in range(23,26):
rightnumbers = []
for n in range(200000, 1000000, 2):
strn = str(n)
if len(set(strn)) != 5:
continue
str12 = str(int(n/2))
if len(set(str12)) != 5:
continue
if len(set(str12 + strn)) != 10:
continue
if str12[2] != str12[5]:
continue
if sod(n) != sod_of_RHS:
continue
rightnumbers.append(n)
print('For sod of', sod_of_RHS)
print('TWELVE RHS pattern')
for r in rightnumbers:
print(int(r/2), r, pattern(r))
try:
print(wdpatterns[pattern(r)], '
')
except:
print('pattern error')
print()
Edited on April 24, 2024, 9:04 pm
|
Posted by Larry
on 2024-04-24 21:03:33 |