|
|
A093048
|
|
a(n) = n minus exponent of 2 in n, with a(0) = 0.
|
|
4
|
|
|
0, 1, 1, 3, 2, 5, 5, 7, 5, 9, 9, 11, 10, 13, 13, 15, 12, 17, 17, 19, 18, 21, 21, 23, 21, 25, 25, 27, 26, 29, 29, 31, 27, 33, 33, 35, 34, 37, 37, 39, 37, 41, 41, 43, 42, 45, 45, 47, 44, 49, 49, 51, 50, 53, 53, 55, 53, 57, 57, 59, 58, 61, 61, 63, 58, 65, 65, 67, 66, 69
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,4
|
|
LINKS
|
|
|
FORMULA
|
Recurrence: a(2n) = a(n) + n - 1, a(2n+1) = 2n + 1.
G.f.: Sum_{k>=0} (t*(t^3 + t^2 + 1)/(1 - t^2)^2), with t = x^2^k.
|
|
EXAMPLE
|
G.f. = x + x^2 + 3*x^3 + 2*x^4 + 5*x^5 + 5*x^6 + 7*x^7 + 5*x^8 + 9*x^9 + ... - Michael Somos, Jan 25 2020
|
|
MAPLE
|
|
|
MATHEMATICA
|
a[ n_] := If[ n == 0, n - 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))
(PARI) a(n) = n - valuation(n, 2) \\ Jianing Song, Oct 24 2018
(Python)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|