A simple algorithm generates the following sequence.
7, 115, 1411, 17141, 227721, 2757061, 35526761, ____?____
What number comes next?
None of the digits is over 7, indicating the numbers might very well be base-8. In base-10 the numbers seem to be rep-7's, so the table below lists the base-8 representation of the first fifteen numbers that consist solely of 7's in base 10.
From the table we see the next value, represented by the question mark is 450545561.
Larry's previously posted problem's involvement with other another base (for pi) was a helpful hint in directing thinking toward, this time, base 8.
7 7
77 115
777 1411
7777 17141
77777 227721
777777 2757061
7777777 35526761
77777777 450545561
777777777 5626771161
7777777777 71745674161
77777777777 1103372532161
777777777777 13242712606161
7777777777777 161134753476161
77777777777777 2153641464156161
777777777777777 26066120012116161
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr(13) + Chr(10)
For i = 1 To 15
n = n * 10 + 7
Text1.Text = Text1.Text & n & " " & base$(n, 8) & crlf
Next i
Text1.Text = Text1.Text & crlf & " done"
End Sub
Function base$(n, b)
v$ = ""
n2 = n
Do
q = Int(n2 / b)
d = n2 - q * b
n2 = q
v$ = Mid("0123456789abcdefghijklmnopqrstuvwxyz", d + 1, 1) + v$
Loop Until n2 = 0
base$ = v$
End Function
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
|
Posted by Charlie
on 2018-05-14 10:33:42 |