The palindromic decimal number N=abccba displays an interesting feature:
The value of abc in base 9 equals the value of cba in base 7.
What is N's prime factorization?
DefDbl AZ
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For n1 = 100 To 999
n2 = 100 * (n1 Mod 10) + 10 * ((n1 \ 10) Mod 10) + n1 \ 100
n = 1000 * n1 + n2
n1s$ = LTrim(Str(n1))
n2s$ = LTrim(Str(n2))
If fromBase(n1s, 9) = fromBase(n2s, 7) Then
Text1.Text = Text1.Text & n & " " & Str(fromBase(n1s, 9)) & crlf
End If
xx = xx
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
Function fromBase(n$, b)
v = 0
For i = 1 To Len(n$)
c$ = LCase$(Mid(n$, i, 1))
If c$ > " " Then
v = v * b + InStr("0123456789abcdefghijklmnopqrstuvwxyz", c$)  1
End If
Next
fromBase = v
End Function
provides two pseudoanswers and the real answer:
182281 155
305503 248
487784 403
The pseudoanswers first:
When 182 is treated as if it were a base9 number, its value is 155. Then, while 281 can't really be a base7 number, we could still treat it as if it could: 2*7^2 + 8*7 + 1 = 155. A similar thing happens when 784 is converted from base 7, as if 8 were a valid base7 digit; it comes out to the same 403 in decimal that 487 comes out when treated as a base9 number.
The true sought answer is the 305 in base 9 is the same as 503 in base 7, as each is 248 in decimal notation.
But the puzzle asks for N's prime factorization.
N = 305503 = 11 * 27773
so N happens to be a semiprime.

Posted by Charlie
on 20170721 10:47:40 