OFFSET
1,4
COMMENTS
The first negative term is a(420) = -1269.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..65537
FORMULA
a(n) = numerator of f(n), where f(1) = 1, f(n) = (1/2) * (A051953(n) - Sum_{d|n, d>1, d<n} f(d) * f(n/d)) for n > 1.
PROG
(PARI)
A317846aux(n) = if(1==n, n, ((n-eulerphi(n))-sumdiv(n, d, if((d>1)&&(d<n), A317846aux(d)*A317846aux(n/d), 0)))/2);
A317846(n) = numerator(A317846aux(n));
(PARI)
\\ Memoized implementation:
memo317846 = Map();
A317846aux(n) = if(1==n, n, if(mapisdefined(memo317846, n), mapget(memo317846, n), my(v = ((n-eulerphi(n))-sumdiv(n, d, if((d>1)&&(d<n), A317846aux(d)*A317846aux(n/d), 0)))/2); mapput(memo317846, n, v); (v)));
CROSSREFS
KEYWORD
sign,frac
AUTHOR
Antti Karttunen, Aug 12 2018
STATUS
approved