login
Number of squares (of nonnegative integers) that require n binary (base-2) digits.
3

%I #10 Apr 13 2021 23:53:35

%S 0,2,0,1,1,2,2,4,4,7,9,14,18,27,37,54,74,107,149,213,299,425,599,849,

%T 1199,1697,2399,3394,4798,6787,9597,13573,19195,27146,38390,54292,

%U 76780,108584,153560,217168,307120,434335,614241,868669,1228483,1737338,2456966

%N Number of squares (of nonnegative integers) that require n binary (base-2) digits.

%C Binary equivalent to A062940, which uses decimal representation.

%H Alois P. Heinz, <a href="/A126726/b126726.txt">Table of n, a(n) for n = 0..1000</a>

%e 21^2 = 441 = 110111001_2, requiring 9 digits.

%p r:= proc(n) local b; b:= isqrt(n); b+`if`(b^2<n, 1, 0) end:

%p a:= n-> `if`(n=0, 0, r(2^n) -r(2^(n-1)) +`if`(n=1, 1, 0)):

%p seq(a(n), n=0..50); # _Alois P. Heinz_, Sep 13 2012

%Y Cf. A062940.

%K base,easy,nonn

%O 0,2

%A Andrew G. West (westa(AT)wlu.edu), Mar 13 2007