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.

A357750 a(n) is the least k such that B(k^2) - B(k) = n, where B(m) is the binary weight A000120(m).

This page as a plain text file.
%I A357750 #21 Jan 03 2025 18:39:46
%S A357750 0,5,11,21,45,75,217,331,181,789,1241,2505,5701,5221,11309,19637,
%T A357750 43151,69451,82709,166027,346389,607307,689685,1458357,1380917,
%U A357750 2507541,5906699,2965685,5931189,11862197,47448787,82188309,57804981,94905541,188883211,373457573,640164021
%N A357750 a(n) is the least k such that B(k^2) - B(k) = n, where B(m) is the binary weight A000120(m).
%e A357750   ----------------------------------------------------
%e A357750   n     k      k^2     binary k             binary k^2
%e A357750   ----------------------------------------------------
%e A357750   0     0        0            0                      0
%e A357750   1     5       25          101                  11001
%e A357750   2    11      121         1011                1111001
%e A357750   3    21      441        10101              110111001
%e A357750   4    45     2025       101101            11111101001
%e A357750   5    75     5625      1001011          1010111111001
%e A357750   6   217    47089     11011001       1011011111110001
%e A357750   7   331   109561    101001011      11010101111111001
%e A357750   8   181    32761     10110101        111111111111001
%e A357750   9   789   622521   1100010101   10010111111110111001
%o A357750 (PARI) a(n) = my(k=0); while(hammingweight(k^2) - hammingweight(k) != n, k++); k;
%o A357750 (Python)
%o A357750 from itertools import count
%o A357750 def A357750(n):
%o A357750     for k in count(0):
%o A357750         if (k**2).bit_count()-k.bit_count()==n:
%o A357750             return k # _Chai Wah Wu_, Oct 17 2022
%Y A357750 Cf. A000120, A000290, A159918, A164343, A164344, A356877, A357658.
%K A357750 nonn,base
%O A357750 0,2
%A A357750 _Karl-Heinz Hofmann_ and _Hugo Pfoertner_, Oct 17 2022