|
|
A162888
|
|
An alternating sum of the first n nonprimes.
|
|
1
|
|
|
1, 3, 3, 4, 5, 15, 6, 7, 8, 24, 9, 10, 11, 33, 12, 13, 39, 14, 42, 15, 16, 17, 51, 18, 54, 19, 20, 60, 21, 22, 23, 69, 24, 25, 75, 26, 78, 27, 28, 84, 29, 87, 30, 31, 32, 96, 33, 99, 34, 35, 105, 36, 37, 38, 114, 39, 117, 40, 41, 123, 42, 43, 129, 44, 132, 45, 46, 138, 47, 141
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
Define an alternating 1-based sum S(n) = (1-0)+(1+1)+(1-2)+...(1-(-1)^n*n) = A064455(n+1).
The sequence evaluates this sum for an upper limit of the n-th nonprime A141468(n).
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
a(1) = 1 = 1 - (-1)^0*0.
a(2) = 3 = 1 - (-1)^0*0 + 1 -(-1)^1*1.
a(3) = 3 = 1 - (-1)^0*0 + 1 -(-1)^1*1 + 1 - (-2)^2*2 + 1 - (-1)^3*3 + 1 - (-1)^4*4.
|
|
MAPLE
|
A141468 := proc(n) option remember; local a; if n = 1 then 0 ; else for a from procname(n-1)+1 do if not isprime(a) then RETURN(a) ; fi; od: fi; end:
A064455 := proc(n) if type(n, 'even') then 3*n/2; else (n+1)/2 ; fi; end:
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|