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.

A038529 n-th prime - n-th composite.

This page as a plain text file.
%I A038529 #34 Jun 27 2021 12:39:13
%S A038529 -2,-3,-3,-2,1,1,3,4,7,11,11,16,19,19,22,27,32,33,37,39,40,45,48,53,
%T A038529 59,62,63,65,65,68,81,83,88,89,98,99,103,108,111,116,121,121,129,130,
%U A038529 133,134,145,155,158,159,161,165,166,175,180,185,189,190,195,197,198,207
%N A038529 n-th prime - n-th composite.
%C A038529 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
%H A038529 Reinhard Zumkeller, <a href="/A038529/b038529.txt">Table of n, a(n) for n = 1..10000</a>
%F A038529 a(n) = A000040(n) - A002808(n). - _Reinhard Zumkeller_, Apr 30 2014
%t A038529 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 *)
%t A038529 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 *)
%o A038529 (Haskell)
%o A038529 a038529 n = a000040 n - a002808 n  -- _Reinhard Zumkeller_, Apr 30 2014
%o A038529 (Python)
%o A038529 from sympy import prime, composite
%o A038529 def A038529(n):
%o A038529     return prime(n)-composite(n) # _Chai Wah Wu_, Dec 27 2018
%Y A038529 Cf. A014237, A067563.
%K A038529 sign,easy
%O A038529 1,1
%A A038529 Vasiliy Danilov (danilovv(AT)usa.net), Jul 14 1998