|
|
A118777
|
|
a(0) = 1; n > 0: a(n) = a(n-1) + d, d = -/+1 if n is prime/nonprime.
|
|
2
|
|
|
1, 2, 1, 0, 1, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3, 4, 5, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9, 10, 11, 10, 11, 10, 11, 12, 13, 14, 15, 14, 15, 16, 17, 16, 17, 16, 17, 18, 19, 18, 19, 20, 21, 22, 23, 22, 23, 24, 25, 26, 27, 26, 27, 26, 27, 28, 29, 30, 31, 30, 31, 32, 33, 32, 33, 32, 33, 34, 35, 36
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
LINKS
|
|
|
FORMULA
|
a(n) = n + 1 - 2*primepi(n), n = 0, 1, 2, ..., where primepi(n) = A000720(n).
a(0) = 1, for n >= 1, a(n) = a(n-1) + (-1)^A010051(n). (from the definition).
(End)
|
|
MATHEMATICA
|
Table[n + 1 - 2*PrimePi[n], {n, 0, 100}]
|
|
PROG
|
(Scheme, two versions, the first defined with memoization-macro definec)
(define (A118777 n) (+ 1 (- n (* 2 (A000720 n))))) ;; After formula given by the original author.
|
|
CROSSREFS
|
For no apparent reason, the terms a(3)..a(24) are equal to the terms a(0)..a(21) of A276090.
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|