login
Squares with a square number of 1's in their binary expansion.
0

%I #37 Dec 12 2023 20:22:43

%S 0,1,4,16,64,169,225,256,676,900,1024,2209,2704,3600,4096,5625,7921,

%T 8836,10201,10816,12321,13689,14400,16384,19321,20449,22201,22500,

%U 23409,26569,27889,28561,29929,30625,31684,32041,35344,38809,40401,40804,43264,49284,52441

%N Squares with a square number of 1's in their binary expansion.

%C If a number k is of the form 2^(2*r), r >= 0, then k is included in this sequence.

%e 225 is in the sequence because it is a square and the number of 1's in the binary expansion of 225 is 4 which is a square.

%p q:= n-> issqr(add(i, i=Bits[Split](n))):

%p select(q, [i^2$i=0..250])[]; # _Alois P. Heinz_, Nov 03 2021

%t Select[Range[0, 300]^2, IntegerQ @ Sqrt[DigitCount[#, 2, 1]] &] (* _Amiram Eldar_, Nov 03 2021 *)

%o (PARI) isok(k) = issquare(k) && issquare(hammingweight(k)); \\ _Michel Marcus_, Nov 03 2021

%Y Intersection of A000290 and A084561.

%Y Cf. A000120, A081092, A344603.

%K nonn,base

%O 1,3

%A _Ctibor O. Zizka_, Nov 03 2021