OFFSET
1,1
COMMENTS
FORMULA
a(n) = Sum_{x=0..n-th nonprime} (2 - x*(-1)^x). - Juri-Stepan Gerasimov, Jul 28 2009
EXAMPLE
a(1) = 2 - 0*(-1)^0 = 2.
a(2) = 2 - 0*(-1)^0 + 2 - 1*(-1)^1 = 2 + 3 = 5.
a(3) = 2 - 0*(-1)^0 + 2 - 1*(-1)^1 + 2 - 2*(-1)^2 + 2 - 3*(-1)^3 + 2 - 4*(-1)^4 = 2 + 3 + 0 + 5 - 2 = 8.
MAPLE
A152832 := proc(n) option remember; if n = 0 then -2; else n-procname(n-1) ; fi; end:
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:
seq(A162938(n), n=1..100) ; # R. J. Mathar, Jul 21 2009
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, Jul 18 2009
EXTENSIONS
Definition edited by R. J. Mathar, Jul 21 2009
STATUS
approved