login
A164029
a(n) = nonprime(n) + (-1)^(nonprime(n)).
1
1, 0, 5, 7, 9, 8, 11, 13, 15, 14, 17, 19, 21, 20, 23, 25, 24, 27, 26, 29, 31, 33, 32, 35, 34, 37, 39, 38, 41, 43, 45, 44, 47, 49, 48, 51, 50, 53, 55, 54, 57, 56, 59, 61, 63, 62, 65, 64, 67, 69, 68, 71, 73, 75, 74, 77, 76, 79, 81, 80, 83, 85, 84, 87, 86, 89, 91, 90, 93, 92, 95
OFFSET
1,3
LINKS
FORMULA
a(n) = A141468(n) + (-1)^A141468(n).
EXAMPLE
a(1)=0+(-1)^0=1. a(2)=1+(-1)^1=0. a(3)=4+(-1)^4=5.
MAPLE
A141468 := proc(n) option remember ; local a; if n <= 2 then n-1 ; else for a from procname(n-1)+1 do if not isprime(a) then RETURN(a) ; fi; od: fi; end:
A164029 := proc(n) A141468(n)+(-1)^A141468(n) ; end: seq(A164029(n), n=1..80) ; # R. J. Mathar, Aug 11 2009
MATHEMATICA
Join[{1}, With[{nn=100}, #+(-1)^#&/@Complement[Range[nn], Prime[ Range[ PrimePi[nn]]]]]] (* Harvey P. Dale, Jul 24 2011 *)
CROSSREFS
Cf. A141468.
Sequence in context: A228578 A242742 A323602 * A364681 A143730 A354454
KEYWORD
nonn,easy
AUTHOR
EXTENSIONS
a(58) corrected by R. J. Mathar, Aug 11 2009
STATUS
approved