login
A163976
prime(n) -(-1)^(n-th nonprime).
1
1, 4, 4, 6, 10, 14, 16, 18, 22, 30, 30, 36, 40, 44, 46, 52, 60, 60, 68, 70, 72, 78, 84, 88, 98, 100, 102, 108, 108, 112, 126, 132, 136, 138, 150, 150, 158, 162, 166, 174, 178, 182, 190, 192, 196, 200, 210, 224, 226, 228, 234, 238, 240, 250, 258, 262, 270, 270, 276, 282, 282
OFFSET
1,2
LINKS
FORMULA
a(n) = A000040(n) -(-1)^A141468(n) .
EXAMPLE
a(1) = 2-(-1)^0 = 1. a(2) = 3-(-1)^1=4.
MATHEMATICA
nonPrime[n_Integer] := FixedPoint[n + PrimePi@# &, n + PrimePi@n];
Table[Prime[n + 1] - (-1)^(nonPrime[n]), {n, 0, 50}] (* G. C. Greubel, Aug 24 2017 *)
Module[{nn=200, np, pr, len}, np=Select[Range[0, nn], !PrimeQ[#]&]; len= Length[ np]; #[[1]]-(-1)^#[[2]]&/@Thread[{Prime[Range[len]], np}]] (* Harvey P. Dale, Jan 24 2021 *)
CROSSREFS
Sequence in context: A098052 A098530 A213379 * A213383 A213425 A213426
KEYWORD
nonn
AUTHOR
EXTENSIONS
Entries checked by R. J. Mathar, Oct 10 2009
STATUS
approved