OFFSET
1,4
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) * (A175851(n) - Sum_{d|n, d>1, d<n} f(d) * f(n/d)) for n > 1.
MATHEMATICA
A175851[n_] := If[!CompositeQ[n], 1, n - NextPrime[n, -1] + 1];
f[n_] := f[n] = If[n == 1, 1, (1/2)(A175851[n] - Sum[If[1 < d < n, f[d]* f[n/d], 0], {d, Divisors[n]}])];
a[n_] := Numerator[f[n]];
Array[a, 100] (* Jean-François Alcover, Dec 19 2021 *)
PROG
(PARI)
A175851(n) = if(1==n, n, 1 + n - precprime(n));
A317830aux(n) = if(1==n, n, (A175851(n)-sumdiv(n, d, if((d>1)&&(d<n), A317830aux(d)*A317830aux(n/d), 0)))/2);
A317830(n) = numerator(A317830aux(n));
(PARI)
\\ Memoized implementation:
memo317830 = Map();
A317830aux(n) = if(1==n, n, if(mapisdefined(memo317830, n), mapget(memo317830, n), my(v = (A175851(n)-sumdiv(n, d, if((d>1)&&(d<n), A317830aux(d)*A317830aux(n/d), 0)))/2); mapput(memo317830, n, v); (v)));
CROSSREFS
KEYWORD
sign,frac
AUTHOR
Antti Karttunen, Aug 12 2018
STATUS
approved