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.

A124001 Difference between first twin prime > 10^n and 10^n.

Original entry on oeis.org

2, 1, 1, 19, 7, 151, 37, 139, 37, 7, 277, 817, 61, 1267, 97, 2371, 1549, 19, 619, 97, 391, 409, 649, 5527, 2731, 559, 949, 427, 601, 2797, 1681, 7189, 2449, 6751, 7597, 8419, 16879, 871, 5569, 10327, 16111, 2131, 6121, 23329, 5179, 4249, 2641, 2257, 3997
Offset: 0

Views

Author

Zak Seidov, Nov 01 2006

Keywords

Comments

a(n) >= A033873(n) and a(n) = A033873(n) for n = 1, 2, 4, 9.
As N increases, the ratio (Sum_{n=1..N} a(n)/n^2)/N tends to 4. - Pierre CAMI, Jul 12 2013

Examples

			a(0) = 2 because 3 and 5 are twin primes and 3 - 10^0 = 2,
a(1) = 1 because 11 and 13 are twin primes and 11 - 10^1 = 1,
a(2) = 1 because 101 and 103 are twin primes and 101 - 10^2 = 1,
a(3) = 19 because 1019 and 1021 are twin primes and 1019 - 10^3 = 19, etc.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{p = q = NextPrime[10^n]}, While[p + 2 != q, p = q; q = NextPrime@ q]; p - 10^n]; Array[f, 49, 0] (* Robert G. Wilson v, Nov 28 2015 *)
    ftp[n_]:=Module[{p=NextPrime[n]},While[CompositeQ[p+2],p=NextPrime[p]];p-n]; Table[ftp[10^n],{n,0,50}] (* Harvey P. Dale, Oct 15 2019 *)

Formula

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

A092250 Lesser of the greatest twin prime pair with n digits.

Original entry on oeis.org

5, 71, 881, 9929, 99989, 999959, 9999971, 99999587, 999999191, 9999999701, 99999999761, 999999999959, 9999999998489, 99999999999971, 999999999997967, 9999999999999641, 99999999999998807, 999999999999998927
Offset: 1

Views

Author

Cino Hilliard, Feb 17 2004

Keywords

Comments

Sum of reciprocals = 0.215331408...
Also the numerator of the largest prime-over-prime fraction less than 1 that is the ratio of two primes both less than 10^n. - Cino Hilliard, Feb 13 2006 [edited by Jon E. Schoenfield, Dec 01 2019]

Crossrefs

Cf. A092245.
Cf. A114429(n) = a(n)+2: largest twin prime < 10^n.

Programs

  • Mathematica
    Array[Block[{k = 10^# - 3}, While[! AllTrue[{k, k + 2}, PrimeQ], k -= 2]; k] &, 18]
  • PARI
    lasttwpr(n) = { sr=0; for(m=0,n, c=0; forstep(x=10^(m+1)-1,10^m,-2, if(isprime(x)&& isprime(x-2),print1(x-2",");sr+=1./(x-2);break) ) ); print(); print(sr) }
    
  • PARI
    apply( {A092250(n,p=10^n)=until(2==p-p=precprime(p-1),);p}, [1..22]) \\ avoids multiple isprime(): much faster! - M. F. Hasler, Jan 17 2022
    
  • 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 pp
    print([a(n) for n in range(1, 19)]) # Michael S. Branicky, Jan 17 2022

A240170 Larger of the greatest cousin prime pair with n digits.

Original entry on oeis.org

7, 83, 971, 9887, 99881, 999983, 9999401, 99999551, 999999761, 9999999707, 99999999947, 999999998867, 9999999999083, 99999999999467, 999999999997841, 9999999999997031, 99999999999998717, 999999999999999161, 9999999999999996587, 99999999999999999803
Offset: 1

Views

Author

Abhiram R Devesh, Aug 02 2014

Keywords

Comments

The sum of the reciprocals converges to 0.156047....
It is only a (plausible) conjecture that this sequence is well-defined. See A152052. - N. J. A. Sloane, Aug 22 2014

Crossrefs

Analogous sequences with twin primes:
- A092245 Lesser of the first twin prime pair with n digits.
- A114429 Larger of the greatest twin prime pair with n digits.

Programs

  • PARI
    a(n)=p=precprime(10^n);while(!isprime(p-4),p=precprime(p-1));return(p)
    vector(50, n, a(n)) \\ Derek Orr, Aug 04 2014
  • Python
    import sympy
    for i in range(1,100):
        a=(10**i)
        p=sympy.prevprime(a)
        while sympy.isprime(p-4)==False:
            p=sympy.prevprime(p)
        print(p)
    
Showing 1-3 of 3 results.