%I #8 Jul 18 2023 02:29:18
%S 0,1,2,1,2,1,2,3,2,1,2,3,2,3,4,3,2,1,2,3,2,3,4,3,2,3,4,3,4,3,4,5,4,3,
%T 2,1,2,3,2,3,2,3,4,3,4,3,4,5,4,3,2,3,4,3,4,5,4,3,4,5,4,5,6,5,4,3,2,1,
%U 2,3,2,3,2,3,4,3,4,3,4,5,4,3,2,3,4,3
%N Hamming weights of A266089.
%H Reinhard Zumkeller, <a href="/A266161/b266161.txt">Table of n, a(n) for n = 0..10000</a>
%F a(n) = A000120(A266089(n)).
%F abs(a(n+1) - a(n)) = 1 by definition of A266089.
%F For n > 0: a(A140253(n)) = n and a(m) < n for m < A140253(n).
%t s[0] = 0; s[n_] := s[n] = Module[{bw = DigitCount[s[n - 1], 2, 1], k = 1}, While[!FreeQ[Array[s, n - 1], k] || Abs[DigitCount[k, 2, 1] - bw] != 1, k++]; k]; DigitCount[Array[s, 100, 0], 2, 1] (* _Amiram Eldar_, Jul 18 2023 *)
%o (Haskell)
%o a266161 = a000120 . a266089
%Y Cf. A000120, A140253, A266089.
%K nonn,base
%O 0,3
%A _Reinhard Zumkeller_, Dec 22 2015
|