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-4 of 4 results.

A079629 Number of twin prime pairs between p^2 and q^2 where (p,q) is the n-th twin prime pair.

Original entry on oeis.org

2, 2, 2, 2, 2, 3, 5, 3, 7, 6, 6, 10, 13, 7, 8, 9, 9, 7, 12, 18, 14, 24, 19, 10, 21, 21, 20, 20, 19, 22, 19, 24, 24, 27, 25, 30, 27, 23, 34, 29, 21, 35, 38, 30, 32, 30, 33, 36, 33, 30
Offset: 1

Views

Author

Paul Boddington, Jan 30 2003

Keywords

Comments

Conjecturally a(n) is always positive. It seems that a(n) might tend to infinity.

Examples

			a(3)=2 because the third twin prime pair is (11,13) and there are 2 twin prime pairs between 121 and 169, namely (137,139) and (149,151).
		

Crossrefs

Programs

  • Mathematica
    ntpp[{a_,b_}]:=Count[Differences[Select[Range[a^2+1,b^2],PrimeQ]],2]; ntpp/@ Select[Partition[Prime[Range[300]],2,1],#[[2]]-#[[1]]==2&] (* Harvey P. Dale, Oct 04 2019 *)

Formula

a(n) = A071538(A006512(n)^2) - A071538(A001359(n)^2). - Reinhard Zumkeller, Feb 16 2008

A273257 Number of twin primes between prime(n) and prime(n)^2.

Original entry on oeis.org

0, 1, 3, 4, 8, 9, 16, 17, 21, 29, 30, 41, 48, 50, 61, 74, 87, 91, 110, 121, 123, 138, 152, 166, 187, 202, 208, 218, 223, 234, 276, 288, 315, 320, 365, 374, 394, 411, 432, 455, 480, 492, 541, 547, 567, 574, 626, 685, 708, 716, 732, 764, 772, 818, 851
Offset: 1

Views

Author

Jesse H. Crotts, Aug 28 2016

Keywords

Comments

Both p and p+2 must appear in the indicated range, and a prime can only be used once (so (3, 5) and (5, 7) can't both be used).
It appears that there should be more twin primes between prime(n) and prime(n)^2 as n increases. Specifically this sequence should be strictly increasing.
Indeed even the number of twin primes between prime(n)^2 and prime(n+1)^2 (A057767) seems to have a lower bound of about n/11. - M. F. Hasler, Jun 27 2019

Examples

			For n=3, prime(3)=5 because it is the 5th prime. There are 3 twin prime subsets on the set {5,6,7,...,24,25} so the 3rd term is 3.
		

Crossrefs

Programs

Extensions

More terms from Charles R Greathouse IV, Aug 28 2016

A308344 a(n) = (A001359(n+1)^2 - 1)/24, where A001359 = lesser of twin primes; or: pentagonal numbers (A000326) whose indices are twin ranks (A002822).

Original entry on oeis.org

1, 5, 12, 35, 70, 145, 210, 425, 477, 782, 925, 1335, 1520, 1617, 2147, 2380, 3015, 3290, 4030, 5017, 7315, 7740, 8855, 11310, 13490, 14950, 15862, 17120, 18095, 27270, 28085, 28497, 30602, 32340, 43265, 44290, 45850, 46905, 49595, 55200, 62935, 67947, 69230, 70525
Offset: 1

Views

Author

M. F. Hasler and A. Dinculescu, Jul 04 2019

Keywords

Comments

Subsequence of A024702 which considers all primes rather than only twins.
This sequence seems to play an important role in studying the twin prime conjecture; see also A057767, A273257, and related.
Dinculescu calls the numbers M(j) = (prime(j)^2 - 1)/6 "basic numbers", and [M(j), M(j+1)] a "twin interval" when j is the index of a twin prime. He notes that the length of such an interval equals four times the corresponding twin rank k(j) = (prime(j) + prime(j+1))/6, see near eq.(3.3) in the 2018 paper.

Examples

			Sequence A001359 = {3, 5, 11, 17, 29, ...} lists the lesser members of pairs of twin primes, (3, 5), (5, 7), (11, 13), (17, 19), ...
We ignore the first and start with the second pair, (5, 7). We have (5^2 - 1)/24 = 1 = a(1).
Next comes the pair (11, 13), whence (11^2 - 1)/24 = 120/24 = 5 = a(2), etc.
		

Crossrefs

Programs

  • Mathematica
    (#^2-1)/24&/@Rest[Select[Partition[Prime[Range[300]],2,1],#[[2]]-#[[1]] == 2&][[All,1]]] (* Harvey P. Dale, Sep 05 2020 *)
  • PARI
    a(n)=A000326(A002822(n))
    
  • PARI
    a(n)=(A001359(n+1)^2-1)/24 \\ or implemented as follows:
    p=0;forprime(q=5,oo,p+2==q&&print1(p^2\24",");p=q)

Formula

a(n) = (A001359(n+1)^2 - 1)/24 = A000326(A002822(n)).

A308777 Number of twin primes between p and p^2 (inclusive) where p is the n-th prime.

Original entry on oeis.org

1, 3, 6, 9, 16, 19, 32, 35, 42, 58, 61, 82, 96, 101, 122, 148, 174, 183, 220, 242, 247, 276, 304, 332, 374, 404, 417, 436, 447, 468, 552, 576, 630, 641, 730, 749, 788, 822, 864, 910, 960, 985, 1082, 1095, 1134, 1149, 1252, 1370, 1416, 1433, 1464, 1528, 1545, 1636, 1702
Offset: 1

Views

Author

Michel Marcus, Jun 24 2019

Keywords

Comments

Similar sequences given in cross-references have further information and references; in particular A273257 has much more efficient PARI code. - M. F. Hasler, Jun 27 2019

Examples

			There is a single twin prime (3) between 2 and 4, so a(1) = 1.
There are 3 twin primes (3, 5 and 7) between 3 and 9, so a(2) = 3.
		

Crossrefs

Cf. A001097 (twin primes), A054272, A057767 (twin pairs between p(n)^2 and p(n+1)^2), A088019.
Cf. A143738 (twin primes between n and n^2), A273257 (twin pairs between prime(n) and prime(n)^2).

Programs

  • Maple
    a:= n-> (p-> add(`if`(isprime(j) and (isprime(j-2) or
            isprime(j+2)), 1, 0), j=p..p^2))(ithprime(n)):
    seq(a(n), n=1..55);  # Alois P. Heinz, Jun 25 2019
  • Mathematica
    a[n_] := With[{p = Prime[n]}, Sum[Boole[PrimeQ[k] && (PrimeQ[k-2] || PrimeQ[k+2])], {k, p, p^2}]];
    Array[a, 55] (* Jean-François Alcover, Feb 29 2020 *)
  • PARI
    a(n) = my(p=prime(n)); sum(k=p, p^2, isprime(k) && (isprime(k-2) || isprime(k+2)));
    
  • Python
    from sympy import prime, prevprime, nextprime
    def A308777(n):
        if n == 1:
            return 1
        c, p = 0, prime(n)
        p2, x = p**2, [prevprime(p), p , nextprime(p)]
        while x[1] <= p2:
            if x[1] - x[0] == 2 or x[2] - x[1] == 2:
                c += 1
            x = x[1:] + [nextprime(x[2])]
        return c # Chai Wah Wu, Jun 25 2019
Showing 1-4 of 4 results.