%I #17 Jul 08 2022 13:27:54
%S 0,0,1,2,2,1,4,3,3,1,3,3,2,3,5,4,4,1,3,3,5,1,4,8,3,2,3,5,6,4,6,5,5,1,
%T 3,3,5,2,6,3,3,3,4,3,4,4,5,6,4,2,3,7,5,1,5,5,3,4,6,6,7,5,7,6,6,1,3,3,
%U 5,2,6,4,7,1,3,3,3,5,6,4,4,2,6,3,5,5,4,6,6,2,4,12,6,5,6,7,5,2,3,6,5,3,6,3,6
%N Exponent of the highest power of 2 dividing binomial(n^2,n).
%C a(n) is the largest integer such that 2^a(n) divides binomial(n^2,n)=A014062(n).
%C a(n) is the number of carries when adding n to n^2-n in base 2. - _Robert Israel_, Oct 23 2019
%H Robert Israel, <a href="/A177424/b177424.txt">Table of n, a(n) for n = 0..10000</a>(n=0 to 1000 from Harvey P. Dale)
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Kummer%27s_theorem">Kummer's theorem</a>
%F a(n) = A007814(A014062(n)).
%e For n = 6, binomial(36,6) = 1947792 = 2^4*3*7*11*17*31, the highest power of 2 is 2^4, and the exponent of 2^4 is a(6)=4.
%p A007814 := proc(n) if type(n,'odd') then 0; else for p in ifactors(n)[2] do if op(1,p) = 2 then return op(2,p); end if; end do: end if; end proc:
%p A014062 := proc(n) binomial(n^2,n) ; end proc:
%p A177424 := proc(n) A007814(A014062(n)) ; end proc: seq(A177424(n),n=0..80) ;
%p # Alternative:
%p nc:= proc(a,b,c)
%p local t;
%p if c=0 and (a=0 or b=0) then return 0 fi;
%p t:= (a mod 2) + (b mod 2) + c;
%p if t < 2 then procname(floor(a/2),floor(b/2),0)
%p else 1 + procname(floor(a/2),floor(b/2),1)
%p fi
%p end proc:
%p seq(nc(n,n^2-n,0),n=0..100); # _Robert Israel_, Oct 23 2019
%t IntegerExponent[Table[Binomial[n^2,n],{n,0,120}],2] (* _Harvey P. Dale_, Mar 31 2019 *)
%o (Python)
%o from math import comb
%o def A177424(n): return (~(m:=comb(n**2,n))& m-1).bit_length() # _Chai Wah Wu_, Jul 08 2022
%o (PARI) valp(n,p=2)=my(s); while(n\=p, s+=n); s
%o a(n)=valp(n^2)-valp(n^2-n)-valp(n) \\ _Charles R Greathouse IV_, Jul 08 2022
%Y Cf. A014062, A000120, A177234
%K nonn,easy
%O 0,4
%A _Michel Lagneau_, May 07 2010
%E Maple program replaced by a structured general version - _R. J. Mathar_, May 10 2010