cp's OEIS Frontend

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.

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).

Original entry on oeis.org

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

Views

Author

Max Alekseyev, Feb 01 2021

Keywords

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.

Crossrefs

Programs

  • 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 *)
  • PARI
    isok(n) = my(hn=hammingweight(n)); hammingweight(n^2) == hn*(hn+1)/2; \\ Michel Marcus, Feb 01 2021