In a 4-word proverb each letter was consistently replaced by a prime number
of 1 or 2 digits.
Spaces betweEn the words were left intact, spaces between digits were erased.
Decode the proverb represented by
3235 71319311 313193714119331 5132931
and comment on its meaning and origin.
BTW: Analytical solution is more challenging and recommended.
The possible segmentations of the four words into primes are as follows:
3 2 3 5
BABC
3 23 5
BIC
7 13 19 3 11
DFHBE
71 3 19 3 11
TBHBE
3 13 19 3 71 41 19 3 31
BFHBTMHBK
31 3 19 3 71 41 19 3 31
KBHBTMHBK
5 13 29 31
CFJK
Each line is followed by an alphabetic representation based on the letter's position in the alphabet being the ordinal number of the prime involved; for example 5 is the third prime and therefore is replaced by C in the alphabetic representation.
The above is from
DefDbl A-Z
Dim crlf$, s$, wd(40), w$
Private Sub Form_Load()
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
Do
p = nxtprm(p)
If p < 100 Then Text1.Text = Text1.Text & Str(p): ct = ct + 1
Loop Until p > 100
Text1.Text = Text1.Text & crlf & ct & crlf & crlf
s$ = "3235 71319311 313193714119331 5132931 "
Do
ix = InStr(s, " ")
w$ = Left(s, ix - 1): s = LTrim(Mid(s, ix + 1))
wd(0) = 0
addon
Text1.Text = Text1.Text & crlf
Loop Until s = ""
End Sub
Sub addon()
For part = 1 To 2
If Len(w) >= part Then
trnum = Val(Left(w, part))
If prmdiv(trnum) = trnum And trnum > 1 Then
savew$ = w
wd(0) = wd(0) + 1
wd(wd(0)) = trnum
w = Mid(w, part + 1)
If w = "" Then
For i = 1 To wd(0)
Text1.Text = Text1.Text & Str(wd(i))
Next
Text1.Text = Text1.Text & crlf
For i = 1 To wd(0)
For j = 1 To 25
If prm(j) = wd(i) Then Exit For
Next
lt$ = Mid("ABCDEFGHIJKLMNOPQRSTUVWXYZ", j, 1)
Text1.Text = Text1.Text & lt$
Next
Text1.Text = Text1.Text & crlf
Else
addon
End If
wd(0) = wd(0) - 1
w = savew
DoEvents
End If
End If
Next
End Sub
Function prm(i)
Dim p As Long
Open "17-bit primes.bin" For Random As #111 Len = 4
Get #111, i, p
prm = p
Close 111
End Function
Function prmdiv(num)
Dim n, dv, q
If num = 1 Then prmdiv = 1: Exit Function
n = Abs(num): If n > 0 Then limit = Sqr(n) Else limit = 0
If limit <> Int(limit) Then limit = Int(limit + 1)
dv = 2: GoSub DivideIt
dv = 3: GoSub DivideIt
dv = 5: GoSub DivideIt
dv = 7
Do Until dv > limit
GoSub DivideIt: dv = dv + 4 '11
GoSub DivideIt: dv = dv + 2 '13
GoSub DivideIt: dv = dv + 4 '17
GoSub DivideIt: dv = dv + 2 '19
GoSub DivideIt: dv = dv + 4 '23
GoSub DivideIt: dv = dv + 6 '29
GoSub DivideIt: dv = dv + 2 '31
GoSub DivideIt: dv = dv + 6 '37
Loop
If n > 1 Then prmdiv = n
Exit Function
DivideIt:
Do
q = Int(n / dv)
If q * dv = n And n > 0 Then
prmdiv = dv: Exit Function
Else
Exit Do
End If
Loop
Return
End Function
Function nxtprm(x)
Dim n
n = x + 1
While prmdiv(n) < n Or n < 2
n = n + 1
Wend
nxtprm = n
End Function
This leads to eight overall possible ordinary (ordinary except that it's possible that a letter represents itself--no guarantee against that) cryptograms:
BABC DFHBE BFHBTMHBK CFJK
BABC DFHBE KBHBTMHBK CFJK
BABC TBHBE BFHBTMHBK CFJK
BABC TBHBE KBHBTMHBK CFJK
BIC DFHBE BFHBTMHBK CFJK
BIC DFHBE KBHBTMHBK CFJK
BIC TBHBE BFHBTMHBK CFJK
BIC TBHBE KBHBTMHBK CFJK
If BFHBTMHBK does not represent a proper name it could be KICKBACKS or REARGUARD. KBHBTMHBK doesn't have any common-word translation in my word list, but still could be a proper name.
Edited on May 14, 2019, 2:47 pm
|
Posted by Charlie
on 2019-05-14 14:46:42 |