Let's substitute each letter of a given word by the value of its ordinal count in the ABC: A=>1, B==>2 .. Z==>26.
Evaluate the total for that word and call it f(k), k being the number of letters in the word.
Let MW(K) be a word for which f(k) is minimal.
Example: assuming the word CAB generates the lowest f(3) then MW(3) is CAB and its f(3)=6.
Question: What triplet of common English words will generate the lowest
f(7)+f(9)+ f(11)?
Choosing the most common (IMHO) from among the following lists:
cabbage, abandoned, abbreviated.
Any of the following words can be used for the first term:
aarrghh
abalone
abashed
abduced
abfarad
academe
acceded
cabbage
Each gives a total of 21 for an average letter value of 3.
Any of the following words can be used for the second term:
aardvarks
abamperes
abandoned
abdicable
beachhead
bedabbled
Each gives a total of 37 for an average letter value of 4.11111111111111
Any of the following words can be used for the third term:
abandonment
abbreviated
abecedarian
abracadabra
Each gives a total of 52 for an average letter value of 4.72727272727273
DefDbl A-Z
Dim crlf$, word$(500)
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For sz = 7 To 11 Step 2
Open "c:\words\words" + LTrim(Str(sz)) + ".txt" For Binary As #1
w$ = Space$(sz)
lowest = 99999
wCt = 0
Do
Get #1, , w$
If EOF(1) Then Exit Do
v = f(w)
If v <= lowest Then
wCt = wCt + 1
word(wCt) = w
lowest = v
End If
Loop Until EOF(1)
For i = 1 To wCt
Text1.Text = Text1.Text & word(i) & crlf
Next
Text1.Text = Text1.Text & lowest & Str(lowest / sz) & crlf & crlf
Close 1
Next sz
Text1.Text = Text1.Text & crlf & " done"
End Sub
Function f(wd$)
tot = 0
For i = 1 To Len(wd)
ix = InStr("abcdefghijklmnopqrstuvwxyz", Mid(wd, i, 1))
tot = tot + ix
Next
f = tot
End Function
|
Posted by Charlie
on 2017-10-20 16:14:49 |