login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 56th year, we are closing in on 350,000 sequences, and we’ve crossed 9,700 citations (which often say “discovered thanks to the OEIS”).

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A022797 n-th prime + n-th 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(n-1) # 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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified December 4 22:42 EST 2021. Contains 349526 sequences. (Running on oeis4.)