%I #21 May 08 2020 06:08:33
%S 0,1,1,2,0,2,2,3,0,1,1,2,1,3,3,4,0,1,1,2,0,2,2,3,0,1,1,3,2,4,4,5,0,1,
%T 1,2,0,2,2,3,0,1,1,2,1,3,3,4,0,1,1,2,0,2,2,3,0,1,2,4,3,5,5,6,0,1,1,2,
%U 0,2,2,3,0,1,1,2,1,3,3,4,0,1,1,2,0,2,2,3,0,1,1,3,2,4,4,5,0,1,1,2,0,2,2,3,0
%N Hamming distance between n and A102370(n) (in binary).
%C The Hamming distance between two strings of the same length is the number of places where they differ. - _Robert G. Wilson v_, Apr 12 2005
%D F. J. MacWilliams and N. J. A. Sloane, The Theory of Error-Correcting Codes, Elsevier/North Holland, 1978, p. 8.
%H David Applegate, Benoit Cloitre, Philippe Deléham and N. J. A. Sloane, Sloping binary numbers: a new sequence related to the binary numbers [<a href="http://neilsloane.com/doc/slopey.pdf">pdf</a>, <a href="http://neilsloane.com/doc/slopey.ps">ps</a>].
%H David Applegate, Benoit Cloitre, Philippe Deléham and N. J. A. Sloane, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL8/Sloane/sloane300.html">Sloping binary numbers: a new sequence related to the binary numbers</a>, J. Integer Seq. 8 (2005), no. 3, Article 05.3.6, 15 pp.
%H Saleem Bhatti, <a href="http://www.cs.ucl.ac.uk/staff/S.Bhatti/D51-notes/node30.html">Channel coding; Hamming distance</a>.
%H Alexander Bogomolny, <a href="http://www.cut-the-knot.org/do_you_know/Strings.shtml">Distance Between Strings</a>.
%H National Institute of Standards and Technology, <a href="http://www.nist.gov/dads/HTML/hammingdist.html">Hamming distance</a>.
%F a(A104235(n)) = 0.
%t f[n_] := Block[{k = 1, s = 0, l = Max[2, Floor[ Log[2, n + 1] + 2]]}, While[ k < l, If[ Mod[n + k, 2^k] == 0, s = s + 2^k]; k++ ]; s]; hammingdistance[n_] := Count[ IntegerDigits[ BitXor[n, f[n] + n], 2], 1]; Table[ hammingdistance[n], {n, 0, 104}] (* _Robert G. Wilson v_, Apr 12 2005 *)
%Y Cf. A102370, A103542, A104235.
%K nonn,easy,base
%O 0,4
%A _Philippe Deléham_, Mar 31 2005
%E More terms from _Robert G. Wilson v_, Apr 12 2005