login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A340956
Integers n such that s(n^2) = s(n)*(s(n)+1)/2, where s(n) is the sum of binary digits of n (A000120).
1
0, 1, 2, 4, 5, 8, 9, 10, 16, 17, 18, 20, 21, 32, 33, 34, 36, 37, 40, 42, 64, 65, 66, 68, 69, 72, 73, 74, 80, 81, 84, 128, 129, 130, 132, 133, 136, 137, 138, 144, 146, 148, 160, 161, 162, 168, 256, 257, 258, 260, 261, 264, 265, 266, 272, 273, 274, 276, 277, 288, 289, 292, 293, 296, 320, 321, 322, 324, 336, 337, 512, 513, 514, 516
OFFSET
1,3
COMMENTS
Also, integers n such that A159918(n) = A000217(A000120(n)).
For any n, s(n^2) <= s(n)*(s(n)+1)/2. This sequence gives n for which the equality is achieved.
LINKS
MAPLE
q:= n-> (s-> is(s(n^2)=(t->t(s(n)))(h->h*(h+1)/2)))(
k-> add(i, i=Bits[Split](k))):
select(q, [$0..555])[]; # Alois P. Heinz, Feb 01 2021
MATHEMATICA
s[n_] := DigitCount[n, 2, 1]; t[n_] := n*(n + 1)/2; Select[Range[0, 500], s[#^2] == t[s[#]] &] (* Amiram Eldar, Feb 01 2021 *)
PROG
(PARI) isok(n) = my(hn=hammingweight(n)); hammingweight(n^2) == hn*(hn+1)/2; \\ Michel Marcus, Feb 01 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Max Alekseyev, Feb 01 2021
STATUS
approved