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

A097453 Primes in A014237 in the order of their appearance.

Original entry on oeis.org

2, 3, 5, 5, 13, 13, 17, 23, 41, 41, 61, 67, 67, 89, 109, 131, 131, 157, 163, 167, 167, 181, 191, 191, 199, 199, 227, 263, 269, 281, 367, 409, 433, 433, 457, 467, 503, 503, 569, 593, 617, 641, 709, 761, 811, 839, 859, 859, 883, 887, 1019, 1033, 1033, 1117, 1193
Offset: 1

Views

Author

Cino Hilliard, Aug 23 2004

Keywords

Examples

			The 10th prime is 29, the 10th composite is 16. 29-16=13 the 5th entry in the table.
		

Crossrefs

Cf. A014237.

Programs

  • PARI
    composite(n) = { local(c,x); c=1; x=0; while(c <= n, x++; if(!isprime(x),c++); ); return(x) } \\ the n-th composite
    primepcomp(n) = { for(x=5,n, y=prime(x)- composite(x); if(isprime(y),print1(y",")) ) }

Extensions

Example corrected by Harvey P. Dale, Aug 21 2019

A322155 Consecutive terms that appear more than once in A014237.

Original entry on oeis.org

-1, 5, 13, 41, 67, 131, 167, 191, 199, 319, 433, 503, 667, 685, 835, 859, 1033, 1565, 1645, 2087, 2695, 2969, 3199, 3329, 3743, 3949, 4135, 4625, 4639, 4831, 5549, 5629, 5663, 5741, 5807, 6031, 6749, 7171, 7543, 8621, 8773, 9161, 9293, 10049, 10333, 11773, 12061, 13057
Offset: 1

Views

Author

Enrique Navarrete, Dec 11 2018

Keywords

Comments

The only term that appears three times is -1, while all other terms appear twice (looking up to n = 10000 in A014237).
Conjecture: the sequence is infinite.

Examples

			-1 is in the sequence since it appears three consecutive times in A014237 (at n = 2, 3, 4).
5 is in the sequence since it appears two consecutive times in A014237 (at n = 7, 8).
		

Crossrefs

Programs

  • Mathematica
    nonPrime[n_] := FixedPoint[n + PrimePi@# &, n + PrimePi@ n];  diff[n_] := Prime[n] - nonPrime[n]; s={}; d1=0; n=3; While[Length[s] < 50, d2 = diff[n]; n++; If[d2 == d1, AppendTo[s, d1]]; d1 = d2]; s (* Amiram Eldar, Dec 12 2018 *)
  • PARI
    nextcomp(c) = {while(isprime(c), c++); c;}
    lista(nn) = {my(p = 2, c = 1, d, v = vector(nn)); for (n=1, nn, v[n] = p - c; p = nextprime(p+1); c = nextcomp(c+1);); my(last = v[1], nb = 1); for (n=2, nn, if (v[n] == last, nb++, if (nb > 1, print1(last, ", ")); last = v[n]; nb = 1););} \\ Michel Marcus, Dec 20 2018

A038529 n-th prime - n-th composite.

Original entry on oeis.org

-2, -3, -3, -2, 1, 1, 3, 4, 7, 11, 11, 16, 19, 19, 22, 27, 32, 33, 37, 39, 40, 45, 48, 53, 59, 62, 63, 65, 65, 68, 81, 83, 88, 89, 98, 99, 103, 108, 111, 116, 121, 121, 129, 130, 133, 134, 145, 155, 158, 159, 161, 165, 166, 175, 180, 185, 189, 190, 195, 197, 198, 207
Offset: 1

Views

Author

Vasiliy Danilov (danilovv(AT)usa.net), Jul 14 1998

Keywords

Comments

Sequence is monotonically increasing starting from a(2). a(n) = a(n+1) if and only if both prime(n)+2 and composite(n)+1 are prime. - Jianing Song, Jun 27 2021

Crossrefs

Programs

  • Haskell
    a038529 n = a000040 n - a002808 n  -- Reinhard Zumkeller, Apr 30 2014
    
  • Mathematica
    composite[n_Integer] := Block[{k=n+PrimePi[n]+1}, While[k-PrimePi[k]-1 != n, k++]; k]; Table[Prime[n] - composite[n], {n,65}] (* corrected by Harvey P. Dale, Aug 08 2011 *)
    Module[{nn=300,prs,cmps,len},prs=Prime[Range[PrimePi[nn]]];cmps= Complement[ Range[4,nn],prs];len=Min[Length[prs],Length[cmps]]; #[[1]]- #[[2]]&/@ Thread[{Take[prs,len],Take[cmps,len]}]] (* Harvey P. Dale, Jun 18 2015 *)
  • Python
    from sympy import prime, composite
    def A038529(n):
        return prime(n)-composite(n) # Chai Wah Wu, Dec 27 2018

Formula

a(n) = A000040(n) - A002808(n). - Reinhard Zumkeller, Apr 30 2014

A127118 a(n) = n-th prime * n-th nonprime.

Original entry on oeis.org

2, 12, 30, 56, 99, 130, 204, 266, 345, 464, 558, 740, 861, 946, 1128, 1325, 1534, 1647, 1876, 2130, 2336, 2607, 2822, 3115, 3492, 3838, 4017, 4280, 4578, 4972, 5715, 6026, 6576, 6811, 7450, 7701, 8164, 8802, 9185, 9688, 10203, 10498, 11460, 11966, 12411
Offset: 1

Views

Author

Neven Juric (neven.juric(AT)apis-it.hr), Mar 21 2007

Keywords

Crossrefs

Programs

  • Haskell
    a127118 n = a000040 n * a018252 n  -- Reinhard Zumkeller, Apr 30 2014
    
  • Mathematica
    Module[{nn=100,prs,non,len},prs=Prime[Range[nn]];non=Complement[ Range[ nn],prs]; len=Min[Length[prs],Length[non]]; Times@@#&/@ Thread[ {Take[ prs,len],Take[non,len]}]] (* Harvey P. Dale, Dec 29 2012 *)
  • Python
    from sympy import prime, composite
    def A127118(n):
        return 2 if n == 1 else prime(n)*composite(n-1) # Chai Wah Wu, Dec 27 2018

Formula

a(n) = A000040(n) * A018252(n).

A071411 "Sum of n first primes" minus "sum of first n nonprimes".

Original entry on oeis.org

1, 0, -1, -2, 0, 3, 8, 13, 21, 34, 47, 64, 84, 105, 128, 156, 189, 223, 262, 303, 344, 390, 439, 493, 554, 617, 681, 748, 815, 884, 966, 1051, 1140, 1230, 1329, 1429, 1534, 1643, 1755, 1872, 1994, 2117, 2248, 2379, 2513, 2648, 2794, 2951, 3110, 3270, 3433, 3600, 3767, 3943, 4124, 4310, 4501, 4692, 4888
Offset: 1

Views

Author

Benoit Cloitre, Jun 23 2002

Keywords

Programs

  • PARI
    for(n=1, 100, s=2; while(sum(i=1, s, 1-isprime(i))
    				

Formula

a(n) = A007504(n) - A051349(n). Cf. A024850.
Partial sums of A014237.

Extensions

Corrected and edited by Jaroslav Krizek, Jun 17 2009
Showing 1-5 of 5 results.