cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A205509 Hamming distance between (n-1)! and n!.

This page as a plain text file.
%I A205509 #33 Dec 30 2024 21:53:08
%S A205509 0,2,1,4,2,4,4,6,4,9,8,15,12,16,14,12,16,23,26,23,21,29,31,34,31,33,
%T A205509 33,44,32,38,42,46,52,51,45,55,55,59,55,59,51,82,65,83,74,75,80,80,80,
%U A205509 74,87,104,86,91,98,90,81,103,104,98,112,104,111,116,111,132
%N A205509 Hamming distance between (n-1)! and n!.
%C A205509 Problem: To find a better lower estimate for a(n) than the trivial one, which is a(n) >= A000120(floor(log_2(n))).
%C A205509 Note that this trivial estimate yields unboundedness of the sequence.
%H A205509 Alois P. Heinz, <a href="/A205509/b205509.txt">Table of n, a(n) for n = 1..1000</a>
%e A205509 Since 5!=(0001111000)_2 and 6!=(1011010000)_2, then the number of different binary digits is 4. Therefore, a(6)=4.
%p A205509 read("transforms") :
%p A205509 Hamming := proc(a,b)
%p A205509         XORnos(a,b) ;
%p A205509         wt(%) ;
%p A205509 end proc:
%p A205509 A205509 := proc(n)
%p A205509         Hamming((n-1)!,n!) ;
%p A205509 end proc: # _R. J. Mathar_, Apr 02 2012
%t A205509 nn = 100; Table[b2 = IntegerDigits[n!, 2]; b1 = IntegerDigits[(n - 1)!, 2, Length[b2]]; Total[Abs[b1 - b2]], {n, nn}] (* _T. D. Noe_, Jan 31 2012 *)
%o A205509 (Sage)
%o A205509 def A205509(n) :
%o A205509     f = bin(factorial(n)).lstrip("0b")
%o A205509     g = bin(factorial(n-1)).lstrip("0b")
%o A205509     h = "".zfill(len(f)-len(g)) + g
%o A205509     return sum(a != b for a, b in zip(f, h))
%o A205509 [A205509(k) for k in (1..66)] # Peter Luschny, Jan 31 2012
%o A205509 (Python)
%o A205509 from math import factorial
%o A205509 def A205509(n): return ((f:=factorial(n-1))^f*n).bit_count() # _Chai Wah Wu_, Jul 13 2022
%Y A205509 Cf. A001511.
%K A205509 nonn,base
%O A205509 1,2
%A A205509 _Vladimir Shevelev_, Jan 28 2012