cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A037024 Position of start of first occurrence of prime(n) after the decimal point in expansion of Pi.

This page as a plain text file.
%I A037024 #21 Aug 01 2024 08:04:17
%S A037024 6,9,4,13,94,110,95,37,16,186,137,46,2,23,119,8,4,219,98,39,299,13,26,
%T A037024 11,12,852,3486,1487,206,362,297,1096,859,525,2606,393,1657,1410,1182,
%U A037024 428,438,728,1944,168,37,704,93,135,484,185,229,1688,1707,1713,1006
%N A037024 Position of start of first occurrence of prime(n) after the decimal point in expansion of Pi.
%H A037024 Michael S. Branicky, <a href="/A037024/b037024.txt">Table of n, a(n) for n = 1..10000</a>
%H A037024 Dave Andersen, <a href="http://www.angio.net/pi/piquery">The Pi-Search Page</a>
%e A037024 Pi = 3.14159265358979323846264338327950288... (see A000796).
%e A037024 First occurrence of prime(23) = 83 starts at the 26th digit after the decimal point, hence a(23) = 26.
%t A037024 Module[{p = Rest[First[RealDigits[Pi, 10, 10^4]]], n = 0, a}, Reap[While[(a = SequencePosition[p, IntegerDigits[Prime[++n]], 1]) != {}, Sow[a[[1, 1]]]]][[2, 1]]] (* _Paolo Xausa_, Aug 01 2024 *)
%o A037024 (Magma) k:=3500; R := RealField(k); [ Position(IntegerToString(Round(10^k*(-3 + Pi(R)))), IntegerToString(NthPrime(n))) : n in [1..55] ]; /* _Klaus Brockhaus_, Feb 15 2007 */
%o A037024 (Python)
%o A037024 from itertools import takewhile
%o A037024 from sympy import S, prime, primerange
%o A037024 # download https://stuff.mit.edu/afs/sipb/contrib/pi/pi-billion.txt, then
%o A037024 # with open('pi-billion.txt', 'r') as f: pi_digits = f.readline()[1:]
%o A037024 pi_digits = str(S.Pi.n(10**4))[1:] # alternative to above
%o A037024 def aupton(nn):
%o A037024     plocs = (pi_digits.find(str(p)) for p in primerange(2, prime(nn)+1))
%o A037024     return list(takewhile(lambda x: x>=0, plocs)) # until p not found
%o A037024 print(aupton(55)) # _Michael S. Branicky_, Jun 12 2021
%Y A037024 Cf. A000796, A014777.
%K A037024 nonn,base
%O A037024 1,1
%A A037024 _Patrick De Geest_, Jan 04 1999
%E A037024 Edited by _Klaus Brockhaus_, Feb 15 2007