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

A046132 Larger member p+4 of cousin primes (p, p+4).

Original entry on oeis.org

7, 11, 17, 23, 41, 47, 71, 83, 101, 107, 113, 131, 167, 197, 227, 233, 281, 311, 317, 353, 383, 401, 443, 461, 467, 491, 503, 617, 647, 677, 743, 761, 773, 827, 857, 863, 881, 887, 911, 941, 971, 1013, 1091, 1097, 1217, 1283, 1301, 1307, 1427, 1433
Offset: 1

Views

Author

Keywords

Comments

A pair of cousin primes are primes of the form p and p+4 (where p+2 may or may not be a prime). - N. J. A. Sloane, Mar 18 2021

Crossrefs

Essentially the same as A031505. Cf. A023200, A029710, A098429.

Programs

  • Haskell
    a046132 n = a046132_list !! (n-1)
    a046132_list = filter ((== 1) . a010051') $ map (+ 4) a000040_list
    -- Reinhard Zumkeller, Aug 01 2014
  • Mathematica
    lst={};Do[p=Prime[n];If[PrimeQ[p4=p+4], (*Print[p4];*)AppendTo[lst, p4]], {n, 10^2}];lst (* Vladimir Joseph Stephan Orlovsky, Aug 21 2008 *)
    Select[Prime[Range[300]],PrimeQ[#+4]&]+4 (* Harvey P. Dale, Dec 15 2017 *)
  • PARI
    forprime(p=2,1e5,if(isprime(p-4),print1(p", "))) \\ Charles R Greathouse IV, Jul 15 2011
    

Formula

a(n) = A023200(n) + 4 = A087679(n) + 2.
a(n) = 3*A157834(n-1) + 2 = A029710(n-1) + 4 = 6*A056956(n-1) + 5 (thus a(n) mod 6 == 5), for all n>1. - M. F. Hasler, Jan 15 2013

A029710 Primes such that next prime is 4 greater.

Original entry on oeis.org

7, 13, 19, 37, 43, 67, 79, 97, 103, 109, 127, 163, 193, 223, 229, 277, 307, 313, 349, 379, 397, 439, 457, 463, 487, 499, 613, 643, 673, 739, 757, 769, 823, 853, 859, 877, 883, 907, 937, 967, 1009, 1087, 1093, 1213, 1279, 1297, 1303, 1423, 1429
Offset: 1

Views

Author

Keywords

Comments

Union with A124588 gives A124589. - Reinhard Zumkeller, Dec 23 2006
For any prime p > 3, if p + 4 is prime then necessarily it is the next prime. But there cannot be three consecutive primes with mutual distance 4: If p and p + 4 are prime, then p+8 is an odd multiple of 3 (cf. formula). - M. F. Hasler, Jan 15 2013
The smaller members p of cousin prime pairs (p,p+4) excluding p=3. - Marc Morgenegg, Apr 19 2016

Examples

			79 is a term as the next prime is 79 + 4 = 83. 3 is not a term even though 3 + 4 = 7 is prime, since it is not the next one.
		

Crossrefs

Essentially the same as A023200.

Programs

  • MATLAB
    p=primes(1700);m=1;
    for u=1:length(p)-4
       if and(isprime(p(u)+4)==1,p(u+1)==p(u)+4);sol(m)=p(u);m=m+1;end
    end
    sol % Marius A. Burtea, Jan 24 2019
  • Magma
    [p:p in PrimesUpTo(1700)| IsPrime(p+4) and NextPrime(p) eq p+4] // Marius A. Burtea, Jan 24 2019
    
  • Maple
    for i from 1 to 226 do if ithprime(i+1) = ithprime(i) + 4 then print({ithprime(i)}); fi; od; # Zerinvary Lajos, Mar 19 2007
  • Mathematica
    Select[Prime[Range[225]], NextPrime[#] == # + 4 &] (* Alonso del Arte, Jan 17 2013 *)
    Transpose[Select[Partition[Prime[Range[300]],2,1],#[[2]]-#[[1]]==4&]] [[1]] (* Harvey P. Dale, Mar 28 2016 *)
  • PARI
    forprime(p=1, 1e4, if(nextprime(p+1)-p==4, print1(p, ", "))) \\ Felix Fröhlich, Aug 16 2014
    

Formula

a(n) = A031505(n + 1) - 4 = A029708(n) - 2.
a(n) = 1 (mod 6) for all n; (a(n) + 2)/3 = A157834(n), i.e., a(n) = 3*A157834(n) - 2. - M. F. Hasler, Jan 15 2013

A029708 Numbers k such that k-2 and k+2 are consecutive primes.

Original entry on oeis.org

9, 15, 21, 39, 45, 69, 81, 99, 105, 111, 129, 165, 195, 225, 231, 279, 309, 315, 351, 381, 399, 441, 459, 465, 489, 501, 615, 645, 675, 741, 759, 771, 825, 855, 861, 879, 885, 909, 939, 969, 1011, 1089, 1095, 1215, 1281, 1299, 1305, 1425, 1431
Offset: 1

Views

Author

Keywords

Comments

All terms are multiples of 3. Minimal first difference is 6. - Zak Seidov, May 15 2013

Crossrefs

Essentially the same as A087679.

Programs

  • Magma
    [k:k in [1..1500]| IsPrime(k-2) and NextPrime(k-2) eq k+2 ]; // Marius A. Burtea, Jan 24 2019
  • Mathematica
    f[n_]:=PrimeQ[n-2]&&PrimeQ[n+2]; lst={};Do[If[f[n],AppendTo[lst,n]],{n,7,8!,2}];lst (* Vladimir Joseph Stephan Orlovsky, Oct 09 2009 *)
    Select[Range[9,1432,6],PrimeQ[#-2]&&PrimeQ[#+2]&] (* Zak Seidov, May 15 2013 - just for terms in DATA *)
    Mean/@Select[Partition[Prime[Range[300]],2,1],#[[2]]-#[[1]]==4&] (* Harvey P. Dale, Feb 15 2020 *)

Formula

a(n) = (A029710(n) + A031505(n+1))/2 = A029710(n) + 2 = A031505(n+1) - 2.

A067830 Primes p such that sigma(p-4) < p.

Original entry on oeis.org

5, 7, 11, 17, 23, 41, 47, 71, 83, 101, 107, 113, 131, 167, 197, 227, 233, 281, 311, 317, 353, 383, 401, 443, 461, 467, 491, 503, 617, 647, 677, 743, 761, 773, 827, 857, 863, 881, 887, 911, 941, 971, 1013, 1091, 1097, 1217, 1283, 1301, 1307, 1427, 1433, 1451
Offset: 1

Views

Author

Benoit Cloitre, Feb 08 2002

Keywords

Comments

Except for the first term, terms are primes of the form p+4 with p prime, i.e., the sequence is essentially A031505, A046132. In other words, the solutions to sigma(x) < x + 4 are 1,2,4 and the odd primes. - Ralf Stephan, Feb 09 2004

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[3, 230]], DivisorSigma[1, #-4] < # &] (* Amiram Eldar, Apr 25 2025 *)
  • PARI
    isok(p) = isprime(p) && (p>4) && (sigma(p-4) < p); \\ Michel Marcus, Feb 15 2021

Extensions

Edited by Charles R Greathouse IV, Mar 19 2010

A118590 Larger of two consecutive primes whose positive difference is a square.

Original entry on oeis.org

3, 11, 17, 23, 41, 47, 71, 83, 101, 107, 113, 131, 167, 197, 227, 233, 281, 311, 317, 353, 383, 401, 443, 461, 467, 491, 503, 617, 647, 677, 743, 761, 773, 827, 857, 863, 881, 887, 911, 941, 971, 1013, 1091, 1097, 1217, 1283, 1301, 1307, 1427, 1433, 1451, 1487
Offset: 1

Views

Author

Cino Hilliard, May 07 2006

Keywords

Examples

			7 and 11 are consecutive primes. 11-7 = 4 a square, so 11 is the second term in the table.
		

Crossrefs

Cf. A031935, A031505, A134117 (gap 6^2), A204670 (gap 8^2), A050434 (gap 10^2), A138198, A161002.

Programs

  • Mathematica
    Select[Table[Prime[n], {n, 2, 237}], IntegerQ[Sqrt[# - Prime[PrimePi[# - 1]]]] &] (* Jayanta Basu, Apr 23 2013 *)
    nn = 500; ps = Prime[Range[nn]]; t = {}; Do[If[IntegerQ[Sqrt[ps[[n]] - ps[[n-1]]]], AppendTo[t, ps[[n]]]], {n, 2, nn}]; t (* T. D. Noe, Apr 23 2013 *)
    Prime[#+1]&/@Flatten[Position[Differences[Prime[Range[250]]],?(IntegerQ[ Sqrt[#]]&)]] (* _Harvey P. Dale, May 08 2019 *)
  • PARI
    g(n) = for(x=2, n, if(issquare(prime(x)-prime(x-1)), print1(prime(x)",")))

Formula

Superset of A031935 and A031505. [From R. J. Mathar, Aug 08 2008]

A111981 Numbers n such that 2n-1 and 2n+3 are consecutive primes.

Original entry on oeis.org

4, 7, 10, 19, 22, 34, 40, 49, 52, 55, 64, 82, 97, 112, 115, 139, 154, 157, 175, 190, 199, 220, 229, 232, 244, 250, 307, 322, 337, 370, 379, 385, 412, 427, 430, 439, 442, 454, 469, 484, 505, 544, 547, 607, 640, 649, 652, 712, 715, 724, 742, 745, 775, 784, 790
Offset: 1

Views

Author

Ray Chandler, Aug 24 2005

Keywords

Crossrefs

Essentially the same as A088762.

Formula

a(n) = (A029708(n)-1)/2 = (A029710(n)+1)/2 = (A031505(n)-3)/2.

A111980 Union of pairs of consecutive primes p, q with q-p = 4.

Original entry on oeis.org

7, 11, 13, 17, 19, 23, 37, 41, 43, 47, 67, 71, 79, 83, 97, 101, 103, 107, 109, 113, 127, 131, 163, 167, 193, 197, 223, 227, 229, 233, 277, 281, 307, 311, 313, 317, 349, 353, 379, 383, 397, 401, 439, 443, 457, 461, 463, 467, 487, 491, 499, 503, 613, 617, 643
Offset: 1

Views

Author

Ray Chandler, Aug 24 2005

Keywords

Crossrefs

Essentially the same as A094343.
Union of A029710 and A031505.
Cf. A140546.

Programs

  • Mathematica
    Flatten[Select[Partition[Prime[Range[200]],2,1],#[[2]]-#[[1]]==4&]]//Union (* Harvey P. Dale, Jul 09 2024 *)

A126720 Primes p such that p - q = 24, where q is the previous prime before p; or prime numbers preceded by precisely 23 composite numbers.

Original entry on oeis.org

1693, 2203, 4201, 4547, 4783, 5261, 6197, 6421, 6761, 7103, 7393, 7817, 8147, 8353, 9091, 11027, 11657, 11863, 12097, 12143, 13033, 13291, 16057, 16217, 16477, 16787, 16811, 17077, 17707, 18013, 18617, 18661, 19207, 19531, 20507, 22433, 22901
Offset: 1

Views

Author

Artur Jasinski, Feb 13 2007

Keywords

Crossrefs

Programs

  • Mathematica
    a = {}; Do[If[Prime[x + 1] - Prime[x] == 24, AppendTo[a, Prime[x + 1]]], {x, 1, 10000}]; a
  • PARI
    q=2; forprime(p=3,1e5, if(p-q==24, print1(p", ")); q=p) \\ Charles R Greathouse IV, Mar 13 2020

Formula

a(n) = A098974(n) + 24. - Amiram Eldar, Mar 13 2020
a(n) >> n log^2 n. - Charles R Greathouse IV, Mar 13 2020
Showing 1-8 of 8 results.