login
A317931
Numerators of rational valued sequence whose Dirichlet convolution with itself yields A002487, Stern's Diatomic sequence.
3
1, 1, 1, 3, 3, 1, 3, 5, 3, 3, 5, 3, 5, 3, 1, 35, 5, 3, 7, 9, 5, 5, 7, 5, 19, 5, 5, 9, 7, 1, 5, 63, 1, 5, 9, 9, 11, 7, 5, 15, 11, 5, 13, 15, 13, 7, 9, 35, 27, 19, 7, 15, 13, 5, 7, 15, 3, 7, 11, 3, 9, 5, -7, 231, -1, 1, 11, 15, 7, 9, 13, 15, 15, 11, 47, 21, 19, 5, 13, 105, 27, 11, 19, 15, 27, 13, 11, 25, 17, 13, 23, 21, 11, 9, 1, 63
OFFSET
1,4
FORMULA
a(n) = numerator of f(n), where f(1) = 1, f(n) = (1/2) * (A002487(n) - Sum_{d|n, d>1, d<n} f(d) * f(n/d)) for n > 1.
PROG
(PARI)
A002487(n) = { my(a=1, b=0); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); (b); }; \\ From A002487
A317931perA317932(n) = if(1==n, n, (A002487(n)-sumdiv(n, d, if((d>1)&&(d<n), A317931perA317932(d)*A317931perA317932(n/d), 0)))/2);
A317931(n) = numerator(A317931perA317932(n));
(PARI)
\\ Memoized implementation:
memo = Map();
A317931perA317932(n) = if(1==n, n, if(mapisdefined(memo, n), mapget(memo, n), my(v = (A002487(n)-sumdiv(n, d, if((d>1)&&(d<n), A317931perA317932(d)*A317931perA317932(n/d), 0)))/2); mapput(memo, n, v); (v)));
CROSSREFS
Cf. A002487, A317932 (denominators, conjectured).
Sequence in context: A202511 A080094 A201873 * A002332 A332547 A302694
KEYWORD
sign,frac,look
AUTHOR
Antti Karttunen, Aug 11 2018
STATUS
approved