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.

Showing 1-3 of 3 results.

A104842 Position of the first sequence of n subsequent digits of Pi which form a prime.

Original entry on oeis.org

1, 1, 8, 3, 2, 1, 4, 34, 30, 5, 15, 2, 6, 17, 36, 82, 12, 87, 26, 12, 25, 133, 35, 18, 17, 3, 41, 17, 234, 17, 167, 92, 251, 15, 9, 12, 31, 1, 57, 290, 4, 99, 98, 502, 48, 164, 198, 201, 128, 7, 363, 143, 11, 138, 196, 32, 230, 82, 292, 515, 334, 186, 176, 223, 57, 135, 35
Offset: 1

Views

Author

Zak Seidov, Mar 27 2005

Keywords

Comments

Note that values with indices n = 22, 43, 55, ... are positions of primes with leading zeros, which is in particular manifest from a(42)=99, a(43)=98. See A198344 for the position of the "true" n-digit primes listed in A104841. - M. F. Hasler, Oct 23 2011

Examples

			a(1)=1 since the first single-digit prime found, 3, is at first place, hence a(1)=1,
a(2)=1 since the first two-digit prime found, 31, is at first place, hence a(2)=1,
a(3)=8 since the first three-digit prime found, 653, is at 8th place, hence a(3)=8, ...
		

Crossrefs

Programs

  • Mathematica
    pi = RealDigits[Pi, 10, 100][[1]]; f[n_] := Block[{k = 1}, While[ !PrimeQ[ FromDigits[ Take[pi, {k, k + n - 1}]]], k++ ]; k]; Table[ f[n], {n, 67}] (* Robert G. Wilson v, Mar 29 2005 *)
  • PARI
    a(n)={for(c=-1,default(realprecision)-n-2,ispseudoprime(Pi\.1^(n+c)%10^n)&return(c+2));error("Insufficient realprecision, please increase.")}  \\  M. F. Hasler, Oct 23 2011

Extensions

More terms from a(33) onward from Robert G. Wilson v, Mar 29 2005

A104841 The first n-digit prime occurring in the decimal expansion of Pi, A000796.

Original entry on oeis.org

3, 31, 653, 4159, 14159, 314159, 1592653, 28841971, 795028841, 5926535897, 93238462643, 141592653589, 9265358979323, 23846264338327, 841971693993751, 8628034825342117, 89793238462643383, 348253421170679821, 3832795028841971693, 89793238462643383279
Offset: 1

Views

Author

Zak Seidov, Mar 27 2005

Keywords

Comments

For the next n-digit primes, see the b-file (link).
Sequence A198344 gives the position of these primes withing the digits of Pi.

Crossrefs

Programs

  • PARI
    default(realprecision,2000); A104841(n)={for( c=0, default(realprecision)-n-2, Pi\.1^c%10 & ispseudoprime(p=Pi\.1^(n+c-1)%10^n) & return(p));error("Please increase default(realprecision) to calculate A104841("n").")}  \\ M. F. Hasler, Oct 23 2011
    
  • Python
    from sympy import S, isprime
    pi = "3"+str(S.Pi.n(10**5))[2:] # or load data from file
    def A104841_A198344(n): return next(((p, i+1) for i in range(len(pi)-n) if pi[i]!="0" and isprime(p:=int(pi[i:i+n]))), "not enough digits")
    print([A104841_A198344(n)[0] for n in range(1, 21)]) # Michael S. Branicky, Dec 28 2022

A272304 Position of the first n-digit prime occurring in the decimal expansion of e.

Original entry on oeis.org

1, 2, 1, 15, 25, 13, 1, 65, 20, 100, 38, 54, 8, 48, 40, 41, 9, 83, 152, 19, 52, 6, 16, 66, 4, 4, 69, 25, 28, 7, 97, 174, 4, 48, 127, 11, 40, 58, 48, 69, 45, 40, 34, 119, 6, 7, 92, 61, 2, 40, 138, 105, 332, 28, 70, 322, 62, 231, 78, 339, 245, 66, 49, 439, 298
Offset: 1

Views

Author

Harvey P. Dale, Apr 25 2016

Keywords

Comments

Leading zeros are not allowed.

Examples

			a(1) = 1 because the initial digit "2" of e is prime.
		

Crossrefs

Programs

  • Mathematica
    With[{ed = RealDigits[E, 10, 10000][[1]]}, Table[Position[Partition[ed, n, 1], _?(PrimeQ[FromDigits[#]] && #[[1]] != 0 &), {1}, 1, Heads -> False], {n, 100}]] // Flatten
Showing 1-3 of 3 results.