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.

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