login
Least m such that B(n!) = B(n!+m), where B(n) is the sum of binary digits of n.
0

%I #12 Dec 15 2017 17:36:09

%S 1,2,3,9,15,16,17,129,129,271,256,1055,1025,2048,2049,32769,32769,

%T 65537,65536,262144,262144,524289,524288,4194307,4194311,8388609,

%U 8388608,33554435,33554433,67108864,67108865,2147483649,2147483649,4294967297

%N Least m such that B(n!) = B(n!+m), where B(n) is the sum of binary digits of n.

%e a(6)=16 because 6! = [1, 0, 1, 1, 0, 1, 0, 0, 0, 0] and 6!+16 = [1, 0, 1, 1, 1, 0, 0, 0, 0, 0].

%o (PARI) a(n) = {s = norml2(binary(n!)); m = 1; while (norml2(binary(m+n!)) != s, m++); return (m);} \\ _Michel Marcus_, Jun 28 2013

%o (PARI) a(n)=my(N=n!,h=hammingweight(N),m);while(hammingweight(N+m++)!=h, ); m \\ _Charles R Greathouse IV_, Jun 28 2013

%Y Cf. A000120.

%K nonn,base

%O 1,2

%A _Jason Earls_, Dec 09 2002

%E More terms from _Sascha Kurz_, Jan 04 2003