Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #24 Sep 13 2024 06:54:14
%S 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,
%T 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,
%U 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
%N a(n) is n minus its largest odd divisor.
%H Antti Karttunen, <a href="/A331739/b331739.txt">Table of n, a(n) for n = 1..16384</a>
%F a(n) = n - A000265(n).
%F Sum_{k=1..n} a(k) ~ n^2/6. - _Amiram Eldar_, Sep 13 2024
%p A331739 := proc(n)
%p n-A000265(n) ;
%p end proc:
%p seq(A331739(n),n=1..40) ; # _R. J. Mathar_, Jan 24 2022
%t a[n_] := n - n/2^IntegerExponent[n, 2];
%t Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Oct 19 2023 *)
%o (PARI) A331739(n) = (n-(n>>valuation(n,2)));
%o (Python)
%o def A331739(n): return n-(n>>(~n & n-1).bit_length()) # _Chai Wah Wu_, Jul 01 2022
%Y Cf. A000265, A006519, A007814, A135481.
%Y Cf. A129527 (even bisection).
%K nonn,easy
%O 1,4
%A _Antti Karttunen_, Feb 02 2020