

A022797


nth prime + nth nonprime.


4



3, 7, 11, 15, 20, 23, 29, 33, 38, 45, 49, 57, 62, 65, 71, 78, 85, 88, 95, 101, 105, 112, 117, 124, 133, 139, 142, 147, 151, 157, 172, 177, 185, 188, 199, 202, 209, 217, 222, 229, 236, 239, 251, 255, 260, 263, 276, 289, 295, 298, 303, 311, 315, 326
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


LINKS

Harvey P. Dale, Table of n, a(n) for n = 1..1000


FORMULA

a(n) = A000040(n) + A018252(n).  Jaroslav Krizek, Nov 18 2009


EXAMPLE

The first four primes are 2, 3, 5, 7 and the first four nonprimes are 1, 4, 6, 8. Hence a(1) = 2 + 1 = 3, a(2) = 3 + 4 = 7, a(3) = 5 + 6 = 11 and a(4) = 7 + 8 = 15.


MATHEMATICA

ppnp[terms_] := Module[{prs = Prime[Range[terms]], nprs, lenprs}, nprs = Complement[Range[Prime[terms]], prs]; lenprs = Length[prs]; Total /@ Thread[{prs, Take[nprs, lenprs]}]]; ppnp[60] (* Harvey P. Dale, Nov 29 2011 *)


PROG

(Python)
from sympy import prime, composite
def A022797(n): return 3 if n == 1 else prime(n)+composite(n1) # Chai Wah Wu, Aug 30 2021


CROSSREFS

Cf. A064799 (with composite numbers instead of nonprimes).
Sequence in context: A330165 A228436 A189364 * A190884 A310211 A310212
Adjacent sequences: A022794 A022795 A022796 * A022798 A022799 A022800


KEYWORD

nonn,easy,nice


AUTHOR

Clark Kimberling


STATUS

approved



