login
A331739
a(n) is n minus its largest odd divisor.
4
0, 1, 0, 3, 0, 3, 0, 7, 0, 5, 0, 9, 0, 7, 0, 15, 0, 9, 0, 15, 0, 11, 0, 21, 0, 13, 0, 21, 0, 15, 0, 31, 0, 17, 0, 27, 0, 19, 0, 35, 0, 21, 0, 33, 0, 23, 0, 45, 0, 25, 0, 39, 0, 27, 0, 49, 0, 29, 0, 45, 0, 31, 0, 63, 0, 33, 0, 51, 0, 35, 0, 63, 0, 37, 0, 57, 0, 39, 0, 75, 0, 41, 0, 63, 0, 43, 0, 77, 0, 45, 0, 69, 0, 47
OFFSET
1,4
LINKS
FORMULA
a(n) = n - A000265(n).
Sum_{k=1..n} a(k) ~ n^2/6. - Amiram Eldar, Sep 13 2024
MAPLE
A331739 := proc(n)
n-A000265(n) ;
end proc:
seq(A331739(n), n=1..40) ; # R. J. Mathar, Jan 24 2022
MATHEMATICA
a[n_] := n - n/2^IntegerExponent[n, 2];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Oct 19 2023 *)
PROG
(PARI) A331739(n) = (n-(n>>valuation(n, 2)));
(Python)
def A331739(n): return n-(n>>(~n & n-1).bit_length()) # Chai Wah Wu, Jul 01 2022
CROSSREFS
Cf. A129527 (even bisection).
Sequence in context: A132748 A022901 A348215 * A356169 A055945 A138123
KEYWORD
nonn,easy
AUTHOR
Antti Karttunen, Feb 02 2020
STATUS
approved