8191 is a more-than-two-digit repunit prime in two bases:
8191 = 111 in base 90 = 1111111111111 in base 2.
Find the only other number with this property.
DefDbl A-Z
Dim crlf$, n(999999, 5)
Private Sub Form_Load()
crlf = Chr(13) + Chr(10)
Text1.Text = ""
For b = 2 To 500
For p = 3 To 100
v = Int(b ^ p - 0.5) / (b - 1)
If v > 999999 Then Exit For
' Text1.Text = Text1.Text & v & crlf
n(v, 0) = n(v, 0) + 1
n(v, n(v, 0)) = b
DoEvents
Next
Next
For i = 1 To 999999
If n(i, 0) > 1 Then
Text1.Text = Text1.Text & i & Str(n(i, 0)) & crlf
For j = 1 To n(i, 0)
Text1.Text = Text1.Text & Str(n(i, j))
Next
Text1.Text = Text1.Text & crlf
End If
Next
Text1.Text = Text1.Text & crlf & tot & " done"
End Sub
finds
31 2
2 5
8191 2
2 90
meaning 31 has 2 repunit representations: base 2 and base 5
and 8191 has 2 repunit representations: base 2 and base 90
The answer is 31, which is a repunit in base 2 and in base 5.
Edited on July 26, 2018, 12:20 pm
|
Posted by Charlie
on 2018-07-26 11:26:45 |