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.

A092245 Lesser of the first twin prime pair with n digits.

Original entry on oeis.org

3, 11, 101, 1019, 10007, 100151, 1000037, 10000139, 100000037, 1000000007, 10000000277, 100000000817, 1000000000061, 10000000001267, 100000000000097, 1000000000002371, 10000000000001549, 100000000000000019
Offset: 1

Views

Author

Cino Hilliard, Feb 17 2004

Keywords

Comments

Sum of reciprocals = 0.43523579465477...

Crossrefs

Programs

  • Maple
    for n from 1 to 100 do
      r:= 10^(n-1);
      p:= nextprime(r); q:= nextprime(p);
      while q - p > 2 do
        p:= q; q:= nextprime(p);
      od;
      A[n]:= p;
    od:
    seq(A[n],n=1..100); # Robert Israel, Aug 04 2014
  • Mathematica
    a[n_] := Block[{p = NextPrime[10^(n -1)]}, While[ !PrimeQ[p +2], p = NextPrime@ p]; p]; Array[a, 18] (* Robert G. Wilson v, Dec 04 2022 *)
  • PARI
    firsttwpr(n) = { sr=0; for(m=0,n, c=0; for(x=10^m+1,10^(m+1), if(isprime(x)&& isprime(x+2),print1(x",");sr+=1./x;break) ) ); print(); print(sr) }
    
  • Python
    import sympy
    for i in range(100):
        p=sympy.nextprime(10**i)
        while not sympy.isprime(p+2):
            p=sympy.nextprime(p)
        print(p)
    # Abhiram R Devesh, Aug 02 2014

Formula

a(n) = A124001(n-1) + 10^(n-1). - Robert G. Wilson v, Nov 28 2015

Extensions

Corrected by T. D. Noe, Nov 15 2006

A114429 Larger of the greatest twin prime pair with n digits.

Original entry on oeis.org

7, 73, 883, 9931, 99991, 999961, 9999973, 99999589, 999999193, 9999999703, 99999999763, 999999999961, 9999999998491, 99999999999973, 999999999997969, 9999999999999643, 99999999999998809, 999999999999998929
Offset: 1

Views

Author

Cino Hilliard, Feb 13 2006

Keywords

Comments

Also the denominator of the largest prime over prime fraction less than 10^n.

Crossrefs

Cf. A092250 (a(n)-2: lesser of the pair).

Programs

  • Mathematica
    Table[i=1;Until[PrimeQ[10^n-i]&&PrimeQ[10^n-i-2],i++];10^n-i,{n,18}] (* James C. McMahon, Jul 31 2024 *)
  • PARI
    a(n)=my(p=precprime(10^n)); while(!ispseudoprime(p-2),p=precprime(p-1)); return(p)
    vector(50, n, a(n)) \\ Derek Orr, Aug 02 2014
    
  • PARI
    apply( {A114429(n,p=10^n)=until(2==p-p=precprime(p-1),);p+2}, [1..22]) \\ twice as fast by avoiding additional ispseudoprime(). - M. F. Hasler, Jan 17 2022
    
  • Python
    import sympy
    for i in range(1,100):
        p=sympy.prevprime(10**i)
        while not sympy.isprime(p-2):
            p=sympy.prevprime(p)
        print(p)
    # Abhiram R Devesh, Aug 02 2014
    
  • Python
    from sympy import prevprime
    def a(n):
        p = prevprime(10**n); pp = prevprime(p)
        while p - pp != 2: p, pp = pp, prevprime(pp)
        return p
    print([a(n) for n in range(1, 19)]) # Michael S. Branicky, Jan 17 2022

Formula

a(n) = A092250(n) + 2. - M. F. Hasler, Jan 17 2022

Extensions

Corrected by T. D. Noe, Nov 15 2006

A327133 The difference between 10^n and the lesser of the twin primes immediately before.

Original entry on oeis.org

5, 29, 119, 71, 11, 41, 29, 413, 809, 299, 239, 41, 1511, 29, 2033, 359, 1193, 1073, 1499, 2261, 5003, 2429, 1793, 4331, 833, 5879, 359, 779, 2813, 1061, 2099, 1811, 3281, 5201, 533, 5483, 1679, 1421, 26801, 12089, 2843, 27773, 9641, 10841, 4763, 2129, 1019, 20531, 8519, 14339
Offset: 1

Views

Author

Robert G. Wilson v, Nov 28 2019

Keywords

Comments

All terms are congruent to 5 (mod 6).
Records: 5, 29, 119, 413, 809, 1511, 2033, 2261, 5003, 5879, 26801, ..., 37058441, ... - Robert G. Wilson v, Dec 10 2019

Examples

			a(1) = 5 because the greatest twin prime pair less than 10 is {5, 7};
a(2) = 29 since the greatest 2-digit twin prime pair is {71, 73};
a(3) = 119 since the greatest 3-digit twin prime pair is {881, 883}; etc.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local w,p,q;
    w:= 10^n; q:= w;
    do
      p:= q;
      q:= prevprime(p);
      if p-q = 2 then return w-q fi;
    od
    end proc:
    map(f, [$1..100]); # Robert Israel, Nov 28 2019
  • Mathematica
    p[n_] := Block[{d = PowerMod[10, n, 6]}, 10^n - NestWhile[# -6 &, 10^n -d -1, !PrimeQ[#] || !PrimeQ[# +2] &]]; Array[p, 50] (* updated Nov 29 2019 *)
  • PARI
    prectwin(n)=n++; while(!isprime(2+n=precprime(n-1)),); n
    a(n)=10^n - prectwin(10^n) \\ Charles R Greathouse IV, Nov 28 2019

Formula

a(n) = A011557(n) - A092250(n).
Showing 1-3 of 3 results.