04-22-2025, 11:30 AM
Here we go. Finds sequences within pi that match the decimal place position. e.g. starting at position 16,470 there is the sequence 16470. Takes 3 minutes 18 seconds on my machine. Pi file of 1 billion decimal places available here -> https://stuff.mit.edu/afs/sipb/contrib/pi/
Code: (Select All)
'Finds self locating numbers within pi
ChDir startdir$ + "pi/"
a$ = _ReadFile$("pi.txt")
Dim loopctr As _Integer64
Dim sequence As _Integer64
starttime = Timer
For loopctr = 3 To 1000000000
digstring$ = Str$(loopctr)
digits = Len(digstring$) - 1
sequence$ = Mid$(a$, loopctr, digits)
sequence = Val(sequence$)
If sequence = loopctr - 2 Then Print loopctr - 2, sequence
Next loopctr
Print
Print Timer - starttime; " seconds"

