Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Splitting REALLY *REALLY* long lines into single character + CR + LF
#11
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"


[Image: Screenshot-at-2025-04-22-21-19-35.png]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] Lines of Code bplus 20 2,978 01-25-2025, 05:11 PM
Last Post: Pete
  very long pathnames and _DirExists (prob ?) doppler 2 799 12-31-2023, 05:04 PM
Last Post: doppler
  Integer (math) Single = Single SMcNeill 0 541 10-20-2023, 12:16 AM
Last Post: SMcNeill
  tweak Str$ for single and double Jack 9 1,715 12-01-2022, 03:51 PM
Last Post: Pete
  Reading a single value from Registry (Win) euklides 1 676 06-06-2022, 02:41 PM
Last Post: euklides

Forum Jump:


Users browsing this thread: 1 Guest(s)