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

Home > Numbers > Sequences
In pi at last (Posted on 2014-03-24) Difficulty: 3 of 5
0, 68, 483, 6716, _____...

See The Solution Submitted by Math Man    
Rating: 4.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution | Comment 2 of 3 |

The following program takes a file with one million digits of pi, downloaded from the internet, with spaces and blank lines removed, to find the last occurrence of novel 2-digit, 3-digit, 4-digit and 5-digit sequences.

REDIM had(10000)
CLS
OPEN "MILPI.TXT" FOR BINARY AS #1
db$ = "  "
hadct = 0
FOR bg = 3 TO 2000
  GET #1, bg, db$
  n = VAL(db$)
  IF had(n) = 0 THEN
'    PRINT n;
    had(n) = 1
    lcn = bg
    dbs$ = db$
    hadct = hadct + 1
  END IF
NEXT
PRINT dbs$, lcn: PRINT hadct: PRINT
trip$ = "   "
hadct = 0
REDIM had(10000)
FOR bg = 3 TO 200000
  GET #1, bg, trip$
  n = VAL(trip$)
  IF had(n) = 0 THEN
'    PRINT n;
    had(n) = 1
    hadct = hadct + 1
    dbs$ = trip$
    lcn = bg
  END IF
NEXT
PRINT : PRINT dbs$, lcn: PRINT hadct: PRINT
REDIM had(10000)
quad$ = "    "
hadct = 0
FOR bg = 3 TO 200000
  GET #1, bg, quad$
  n = VAL(quad$)
  IF had(n) = 0 THEN
'    PRINT n;
    had(n) = 1
    lcn = bg
    dbs$ = quad$
    hadct = hadct + 1
  END IF
NEXT
PRINT : PRINT dbs$; lcn: PRINT hadct
'hadct = 0
'FOR i = 1 TO 10000: IF had(i) = 0 THEN PRINT i;
': NEXT
quint$ = "     "
hadct = 0
KILL "had.txt"
OPEN "had.txt" FOR BINARY AS #10
FOR bg = 3 TO 999994
  GET #1, bg, quint$
  n = VAL(quint$)
  h$ = " "
  IF n <> 0 THEN
    GET #10, n, h$
    IF h$ <> "x" THEN
'      PRINT n;
      h$ = "x"
      PUT #10, n, h$
      lcn = bg
      dbs$ = quint$
      hadct = hadct + 1
    END IF
  END IF
NEXT
PRINT : PRINT dbs$, lcn: PRINT hadct


It finds

68             607
 100


483            8555
 1000


6716          99848
 10000

36748          967161
 99991
 
Meaning:

68 was the last of the possible 100 2-digit sequences to be found, and it was found at location 607 (counting the 3 and the decimal point).

483 was the last of the possible 1000 3-digit sequences; found at locaton 8555.

6716 was the last of the possible 10000 4-digit sequences; found at locaton 99848.

At the next spot we hoped to find the next item in the sequence. However, 36748 was the last of only 99991 5-digit sequences to be found. There are 9 more, so the next item in sequence is one of those.

I had no luck in downloading any of the Googlable expansions of pi beyond a million digits, but Sloane's OEIS has the sequence: A032510: 0, 68, 483, 6716, 33394, 569540, 1075656, 36432643, 172484538, 5918289042, 56377726040, ... .

The blank can be filled with 33394.

I see from another OEIS sequence that I'd have needed 1369565 digits of pi to get my answer. My position numbering is different from that sequence as I count from the beginning of the found digits and they count to the end.

Edited on March 24, 2014, 10:40 am
  Posted by Charlie on 2014-03-24 10:35:18

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (15)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information