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.

A158288 The number of twin prime pairs in the n-th century.

Original entry on oeis.org

8, 7, 4, 2, 3, 2, 3, 0, 5, 0, 5, 1, 3, 2, 4, 0, 4, 2, 2, 3, 3, 3, 2, 3, 0, 2, 2, 3, 1, 1, 0, 2, 2, 4, 2, 4, 1, 1, 2, 2, 4, 2, 5, 1, 2, 2, 2, 2, 0, 2, 2, 0, 2, 0, 3, 2, 3, 1, 3, 0, 1, 2, 1, 1, 1, 2, 2, 4, 2, 2, 0, 1, 1, 3, 2, 3, 0, 1, 1, 1, 2, 0, 3, 1, 1, 2, 1, 0, 3, 1, 2, 0, 2, 1, 4, 0, 2, 2, 1, 1, 4, 1, 1, 2, 2
Offset: 1

Views

Author

Ki Punches, Mar 15 2009

Keywords

Comments

The number of members of A001359 from 100*n-99 to 100*n-3. - Robert Israel, Jul 19 2017

Crossrefs

Programs

  • Maple
    f:= proc(n) local P;
       P:= select(isprime, {seq(i,i=100*n-99..100*n-1,2)});
       nops(P intersect map(`+`,P,2))
    end proc:
    map(f, [$1..200]); # Robert Israel, Jul 19 2017
  • Mathematica
    Table[Count[Prime@ Range[Boole[n == 1] + PrimePi[100 (n - 1) + 1], PrimePi[100 n] - 1], ?(PrimeQ[# + 2] &)], {n, 105}] (* _Michael De Vlieger, Jul 20 2017 *)
  • PARI
    a(n)=my(s=0);forprime(p=100*n-99,100*n-2,if(isprime(p+2),s++));s \\ Charles R Greathouse IV, Feb 03 2011
    
  • Python
    from sympy import primerange, isprime
    def a(n):
        s=0
        for p in primerange(100*n - 99, 100*n - 1):
            if isprime(p + 2):s+=1
        return s
    print([a(n) for n in range(1, 201)]) # Indranil Ghosh, Jul 20 2017, after PARI code

Formula

a(n) = A071538(100*n-3) - A071538(100*n-100). - Robert Israel, Jul 19 2017

Extensions

Corrected by Ray Chandler, May 23 2009