login
Integers whose Hamming weight is triangular.
2

%I #14 May 30 2021 20:56:58

%S 0,1,2,4,7,8,11,13,14,16,19,21,22,25,26,28,32,35,37,38,41,42,44,49,50,

%T 52,56,63,64,67,69,70,73,74,76,81,82,84,88,95,97,98,100,104,111,112,

%U 119,123,125,126,128,131,133,134,137,138,140,145,146,148,152,159,161

%N Integers whose Hamming weight is triangular.

%H Alois P. Heinz, <a href="/A344602/b344602.txt">Table of n, a(n) for n = 1..20000</a>

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

%p select(q, [$0..200])[]; # _Alois P. Heinz_, May 24 2021

%t Select[Range[0, 200], IntegerQ @ Sqrt[8 * Plus @@ IntegerDigits[#, 2] + 1] &] (* _Amiram Eldar_, May 24 2021 *)

%o (PARI) isok(n) = ispolygonal(hammingweight(n), 3);

%Y Cf. A000120, A000217, A344603.

%K nonn,base

%O 1,3

%A _Michel Marcus_, May 24 2021