All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 2 bases (Posted on 2017-07-21)
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?

 See The Solution Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution (spoiler) Comment 2 of 2 |
DefDbl A-Z
Dim crlf\$

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

182281  155
305503  248
487784  403

When 182 is treated as if it were a base-9 number, its value is 155. Then, while 281 can't really be a base-7 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 base-7 digit; it comes out to the same 403 in decimal that 487 comes out when treated as a base-9 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 2017-07-21 10:47:40

 Search: Search body:
Forums (0)