|
|
A093049
|
|
n-1 minus exponent of 2 in n, a(0) = 0.
|
|
4
|
|
|
0, 0, 0, 2, 1, 4, 4, 6, 4, 8, 8, 10, 9, 12, 12, 14, 11, 16, 16, 18, 17, 20, 20, 22, 20, 24, 24, 26, 25, 28, 28, 30, 26, 32, 32, 34, 33, 36, 36, 38, 36, 40, 40, 42, 41, 44, 44, 46, 43, 48, 48, 50, 49, 52, 52, 54, 52, 56, 56, 58, 57, 60, 60, 62, 57, 64, 64, 66, 65, 68
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,4
|
|
LINKS
|
|
|
FORMULA
|
Recurrence: a(2n) = a(n) + n - 1, a(2n+1) = 2n.
G.f.: sum(k>=0, t^3(t+2)/(1-t^2)^2, t=x^2^k).
|
|
EXAMPLE
|
G.f. = 2*x^3 + x^4 + 4*x^5 + 4*x^6 + 6*x^7 + 4*x^8 + 8*x^9 + 8*x^10 + ... - Michael Somos, Jan 25 2020
|
|
MATHEMATICA
|
a[ n_] := If[ n == 0, 0, n - 1 - IntegerExponent[n, 2]]; (* Michael Somos, Jan 25 2020 *)
|
|
PROG
|
(PARI) a(n)=if(n<1, 0, if(n%2==0, a(n/2)+n/2-1, n-1))
(PARI) {a(n) = if( n, n - 1 - valuation(n, 2))}; /* Michael Somos, Jan 25 2020 */
(Python)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|