A265918 a(n) = A070939(n) mod A000120(n), where A070939(n) is the binary length of n and A000120(n) is the binary weight of n.
0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 2, 1, 2, 2, 1, 1, 2, 2, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 2, 1, 0, 0, 0, 2, 0, 2, 2, 1, 0, 2, 2, 1, 2, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 3, 1, 3, 3, 2, 1, 1, 1, 3, 1, 3, 3
Offset: 1
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
Table[Mod[IntegerLength[n, 2], Total@ IntegerDigits[n, 2]], {n, 120}] (* Michael De Vlieger, Dec 21 2015 *)
-
PARI
a(n) = #binary(n) % hammingweight(n); \\ Michel Marcus, Dec 19 2015
-
Python
for n in range(1, 88): print((len(bin(n))-2) % bin(n).count('1'), end=', ')