There are several (how many?) words in the English language, replacing the
? sign in the alphametic
nineteen + nineteen = ?
to make it uniquely solvable,
but only one is a name of famous mathematician.
Find this name and solve this alphametic.
List of 8- and 9-letter mathematicians from an online list:
Poincare
Lagrange
Descartes
Dirichlet
Ramanujan
Fibonacci
Hamilton
Aryabhata
final program output:
1i23n455i
1i23n455i 6 2 8 4 125369772
interpretation:
nineteen + nineteen = Fibonacci
62684886 + 62684886 = 125369772
program description:
part 1 produces possible codes
after that output was manually sorted, the second part was run by emplacing the bypass.
part 2 read the list of 8 mathematicians for each output line of part 1 and encoded the same way as the answers to nineteen + nineteen, and found a match.
(the sort was unnecessary; it was done on a first idea of how to go about this)
program:
DefDbl A-Z
Dim crlf$, used(9), math(8) As String
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
GoTo roundabout
Open "\vb5 projects\flooble\9-letter words ii.txt" For Output As #2
For iv = 0 To 9
Text1.Text = Text1.Text & iv & crlf
used(iv) = 1
For e = 0 To 9
If used(e) = 0 Then
used(e) = 1
For n = 1 To 9
If used(n) = 0 Then
used(n) = 1
For t = 0 To 9
DoEvents
If used(t) = 0 Then
used(t) = 1
nineteen = 10100001 * n + 1000000 * iv + 10110 * e + 1000 * t
ss$ = LTrim(Str(2 * nineteen))
l = Len(ss)
difflet = 0: wordform$ = "": usedlet$ = ""
For i = 1 To l
charval = Val(Mid(ss, i, 1))
Select Case charval
Case n
wordform = wordform + "n"
Case iv
wordform = wordform + "i"
Case t
wordform = wordform + "t"
Case e
wordform = wordform + "e"
Case Else
If InStr(ss, Mid(ss, i, 1)) = i Then
difflet = difflet + 1
usedlet = usedlet + Mid(ss, i, 1)
End If
ix = InStr(usedlet, Mid(ss, i, 1))
wordform = wordform + LTrim(Str(ix))
End Select
Next
Text1.Text = Text1.Text & wordform & " " & n & Str(iv) & Str(e) & Str(t) & " " & ss & crlf
Print #2, wordform & " " & n & Str(iv) & Str(e) & Str(t) & " " & ss
used(t) = 0
End If
Next
used(n) = 0
End If
Next
used(e) = 0
End If
Next
used(iv) = 0
Next
Close 2
roundabout:
Open "\vb5 projects\flooble\mathematicians.txt" For Input As #1
Do
mct = mct + 1
Input #1, ln$
ln = LCase(LTrim(RTrim(ln)))
l = Len(ln)
difflet = 0: wordform$ = "": usedlet$ = ""
For i = 1 To l
cv$ = Mid(ln, i, 1)
Select Case cv
Case "n"
wordform = wordform + "n"
Case "i"
wordform = wordform + "i"
Case "t"
wordform = wordform + "t"
Case "e"
wordform = wordform + "e"
Case Else
If InStr(ln, Mid(ln, i, 1)) = i Then
difflet = difflet + 1
usedlet = usedlet + Mid(ln, i, 1)
End If
ix = InStr(usedlet, Mid(ln, i, 1))
wordform = wordform + LTrim(Str(ix))
End Select
Next
math(mct) = wordform
Loop Until EOF(1)
Close 1
Open "\vb5 projects\flooble\9-letter words ii sorted.txt" For Input As #1
Do
Line Input #1, ln$
ls$ = ln$
ix = InStr(ln, " ")
ln = Left(ln, ix - 1)
ln = LTrim(RTrim(ln))
For i = 1 To 8
If ln = math(i) Then
Text1.Text = Text1.Text & math(i) & crlf
Text1.Text = Text1.Text & ls & crlf & crlf
End If
Next
Loop Until EOF(1)
Close 1
Text1.Text = Text1.Text & crlf & " done"
End Sub
|
Posted by Charlie
on 2015-11-13 15:49:41 |