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.
%I A168160 #17 Jan 17 2025 07:10:56 %S A168160 0,2,2,7,8,9,9,19,21,23,24,26,27,28,28,47,50,53,55,58,60,62,63,66,68, %T A168160 70,71,73,74,75,75,111,115,119,122,126,129,132,134,138,141,144,146, %U A168160 149,151,153,154,158,161,164,166,169,171,173,174,177,179,181,182,184,185,186 %N A168160 Number of 0's in the matrix whose lines are the binary expansion of the numbers 1,...,n. %C A168160 The matrix is to be taken of minimal size, i.e., have n lines and the number of columns needed to write n in base 2 in the last line, A070939(n). Otherwise said, there is no zero column. %C A168160 The number of zeros in the last line of the matrix is given by A023416(n). %C A168160 One has a(n)=a(n-1) iff n = 2^k-1 for some k. %H A168160 Paolo Xausa, <a href="/A168160/b168160.txt">Table of n, a(n) for n = 1..10000</a> %F A168160 a(n) = n*A070939(n) - A000788(n) = A380230(n) - A000788(n). %e A168160 a(4)=7 is the number of zeros in the matrix %e A168160 [001] /* = 1 in binary */ %e A168160 [010] /* = 2 in binary */ %e A168160 [011] /* = 3 in binary */ %e A168160 [100] /* = 4 in binary */ %t A168160 #*BitLength[#] - Accumulate[DigitCount[#, 2, 1]] & [Range[100]] (* _Paolo Xausa_, Jan 17 2025 *) %o A168160 (PARI) A168160(n)=n*#binary(n)-sum(i=1,n,norml2(binary(i))) %o A168160 (Python) %o A168160 def A168160(n): return n*(a:=n.bit_length())-(n+1)*n.bit_count()-(sum((m:=1<<j)*((k:=n>>j)-(r if n<<1>=m*(r:=k<<1|1) else 0)) for j in range(1,a+1))>>1) # _Chai Wah Wu_, Nov 11 2024 %Y A168160 Cf. A000788, A070939, A023416, A059015, A380230. %K A168160 base,nonn %O A168160 1,2 %A A168160 _M. F. Hasler_, Nov 22 2009