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.

Showing 1-8 of 8 results.

A089999 Smallest triangular number with Hamming weight n (i.e., with exactly n 1's when written in binary).

Original entry on oeis.org

0, 1, 3, 21, 15, 55, 190, 253, 703, 3003, 5886, 13695, 4095, 49141, 106491, 192510, 784378, 1915903, 3407355, 5240703, 15986685, 30400503, 48201471, 124780503, 247431135, 602930175, 1608777726, 4290575295, 7482375615, 15938355070
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 20 2003

Keywords

Comments

A000120(a(n)) = n.
a(n) = A000217(A211201(n)). - Reinhard Zumkeller, Mar 18 2013

Crossrefs

Programs

  • Haskell
    a089999 = a000217 . a211201  -- Reinhard Zumkeller, Mar 18 2013
  • Mathematica
    a = Table[0, {30}]; Do[t = n(n + 1)/2; c = Count[ IntegerDigits[t, 2], 1]; If[ a[[c + 1]] == 0, a[[c + 1]] = t], {n, 1, 10^8}]; a (* Robert G. Wilson v, Dec 03 2003 *)

Extensions

More terms from Robert G. Wilson v, Dec 03 2003
Offset corrected by Donovan Johnson, May 01 2012

A231897 a(n) = smallest m such that wt(m^2) = n (where wt(i) = A000120(i)), or -1 if no such m exists.

Original entry on oeis.org

0, 1, 3, 5, 13, 11, 21, 39, 45, 75, 155, 217, 331, 181, 627, 923, 1241, 2505, 3915, 5221, 6475, 11309, 15595, 19637, 31595, 44491, 69451, 113447, 185269, 244661, 357081, 453677, 1015143, 908091, 980853, 2960011, 4568757, 2965685, 5931189, 11862197, 20437147
Offset: 0

Views

Author

N. J. A. Sloane, Nov 19 2013

Keywords

Comments

Conjecture: a(n) is never -1. (It seems likely that the arguments of Lindström (1997) could be modified to establish this conjecture.)
a(n) is the smallest m such that A159918(m) = n (or -1 if ...).

Crossrefs

A089998 are the corresponding squares.

Programs

  • Haskell
    a231897 n = head [x | x <- [1..], a159918 x == n]
    -- Reinhard Zumkeller, Nov 20 2013
    
  • PARI
    a(n)=if(n,my(k); while(hammingweight(k++^2)!=n,); k, 0) \\ Charles R Greathouse IV, Aug 06 2015
    
  • Python
    def wt(n): return bin(n).count('1')
    def a(n):
        m = 2**(n//2) - 1
        while wt(m**2) != n: m += 1
        return m
    print([a(n) for n in range(32)]) # Michael S. Branicky, Feb 06 2022

Formula

a(n) = 2*A211201(n-1) + 1 for n >= 1. - Hugo Pfoertner, Feb 06 2022

Extensions

a(26)-a(40) from Reinhard Zumkeller, Nov 20 2013

A090001 Length of longest contiguous block of 1's in binary expansion of n^2.

Original entry on oeis.org

0, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 4, 1, 1, 2, 3, 1, 1, 1, 2, 2, 3, 4, 1, 1, 3, 1, 2, 2, 2, 3, 4, 1, 1, 1, 2, 1, 2, 2, 5, 2, 2, 3, 3, 4, 6, 1, 1, 1, 2, 3, 1, 1, 5, 2, 4, 2, 2, 2, 2, 3, 3, 4, 5, 1, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 6, 2, 3, 5, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 6, 2, 1, 3, 1, 2, 1, 2, 2, 2, 3, 5
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 20 2003

Keywords

Comments

a(n) = A038374(A000290(n)).

Crossrefs

Programs

  • Mathematica
    Join[{0},Table[Max[Length/@Select[Split[IntegerDigits[n^2,2]], MemberQ[ #,1]&]],{n,110}]] (* Harvey P. Dale, Nov 28 2014 *)

A102029 Smallest semiprime with Hamming weight n (i.e., smallest semiprime with exactly n ones when written in binary), or -1 if no such number exists.

Original entry on oeis.org

4, 6, 14, 15, 55, 95, 247, 447, 511, 1535, 2047, 7167, 12287, 32255, 49151, 98303, 196607, 393215, 983039, 1572863, 3145727, 6291455, 8388607, 33423359, 50331647, 117440511, 201326591, 528482303, 805306367, 1879048191, 3221225471
Offset: 1

Views

Author

Jonathan Vos Post, Jun 23 2007

Keywords

Comments

Semiprime analog of A061712. Extended by Stefan Steinerberger. Includes the subset Mersenne semiprimes A092561.

Examples

			a(1) = 4 because the first semiprime A001358(1) is 4 (base 10) which is written 100 in binary, the latter representation having exactly 1 one.
a(2) = 6 since A001358(2) = 6 = 110 (base 2) has exactly 2 ones.
a(4) = 15 since A001358(6) = 15 = 1111 (base 2) has exactly 4 ones and, as it also has no zeros, is the smallest of the Mersenne semiprimes.
		

Crossrefs

Programs

  • Mathematica
    Join[{4},Table[SelectFirst[Sort[FromDigits[#,2]&/@Permutations[ Join[ PadRight[{}, n,1],{0}]]],PrimeOmega[#]==2&],{n,2,40}]] (* Harvey P. Dale, Feb 06 2015 *)

A358930 a(n) is the smallest n-gonal number with binary weight n.

Original entry on oeis.org

21, 169, 117, 190, 1404, 9976, 3961, 11935, 19966, 113401, 98155, 208879, 261501, 3338221, 916475, 3100671, 9943039, 31457140, 50322871, 100523871, 264240373, 2113871829, 2012739435, 532673535, 7415513007, 33017544153, 17112759966, 50983861215, 59039022015
Offset: 3

Views

Author

Ilya Gutkovskiy, Dec 06 2022

Keywords

Examples

			117 is the smallest pentagonal number with binary weight 5 (117_10 = 1110101_2), so a(5) = 117.
		

Crossrefs

Programs

  • Mathematica
    p[n_, k_] := (n - 2)*k*(k - 1)/2 + k; a[n_] := Module[{k = 1, pk}, While[DigitCount[pk = p[n, k], 2, 1] != n, k++]; pk]; Array[a, 25, 3] (* Amiram Eldar, Dec 09 2022 *)

A359316 a(n) is the smallest centered square number with binary weight n.

Original entry on oeis.org

1, 5, 13, 85, 61, 221, 761, 1013, 2813, 12013, 23545, 54781, 16381, 196565, 425965, 770041, 3137513, 7663613, 13629421, 20962813, 63946741, 121602013, 192805885, 499122013, 989724541, 2411720701, 6435110905, 17162301181, 29929502461, 63753420281
Offset: 1

Views

Author

Ilya Gutkovskiy, Dec 25 2022

Keywords

Examples

			221 is the smallest centered square number with binary weight 6 (221_10 = 11011101_2), so a(6) = 221.
		

Crossrefs

Programs

  • Mathematica
    seq[len_,nmax_] := Module[{s = Table[0,{len}], n = 0, c = 0, bw, cs}, While[c < len && n < nmax, bw = DigitCount[cs = 2*n*(n+1) + 1, 2, 1]; If[bw <= len && s[[bw]] == 0, c++; s[[bw]] = cs]; n++]; s]; seq[30, 10^6] (* Amiram Eldar, Dec 26 2022 *)

A359318 a(n) is the smallest square pyramidal number with binary weight n.

Original entry on oeis.org

0, 1, 5, 14, 30, 55, 819, 506, 1785, 1015, 16206, 51039, 98021, 81375, 1113775, 964535, 2607099, 5494655, 1048061, 6029275, 50331190, 356343295, 534555645, 516941815, 4021378559, 2143222510, 12842950505, 34091142526, 68651299705, 124545644405, 273736383990
Offset: 0

Views

Author

Ilya Gutkovskiy, Dec 25 2022

Keywords

Examples

			819 is the smallest square pyramidal number with binary weight 6 (819_10 = 1100110011_2), so a(6) = 819.
		

Crossrefs

Programs

  • Maple
    V:= Array(0..40): count:= 0:
    for k from 1 while count < 40 do
      m:= k*(k+1)*(2*k+1)/6;
      w:= convert(convert(m,base,2),`+`);
      if w <= 40 and V[w] = 0 then
        count:= count+1; V[w]:= m;
      fi
    od:
    convert(V,list); # Robert Israel, Dec 26 2022
  • Mathematica
    seq[len_,nmax_] := Module[{s = Table[0,{len}], n = 0, c = 0, bw, sp}, While[c < len && n < nmax, bw = DigitCount[sp = n*(n+1)*(2*n+1)/6, 2, 1] + 1; If[bw <= len && s[[bw]] == 0, c++; s[[bw]] = sp]; n++]; s]; seq[31, 10^6] (* Amiram Eldar, Dec 26 2022 *)

A354480 a(n) is the smallest decimal palindrome with Hamming weight n (i.e., with exactly n 1's when written in binary).

Original entry on oeis.org

0, 1, 3, 7, 77, 55, 111, 191, 383, 767, 5115, 11711, 15351, 30703, 81918, 97279, 744447, 978879, 1570751, 3665663, 8387838, 66911966, 66322366, 132111231, 199212991, 389545983, 939474939, 3204444023, 3220660223, 11542724511, 34258485243, 33788788733, 34292629243
Offset: 0

Views

Author

Ilya Gutkovskiy, Jun 02 2022

Keywords

Crossrefs

Programs

  • Python
    from itertools import count, islice, product
    def pals(startd=1): # generator for base-10 palindromes
        for d in count(startd):
            for p in product("0123456789", repeat=d//2):
                if d//2 > 0 and p[0] == "0": continue
                left = "".join(p); right = left[::-1]
                for mid in [[""], "0123456789"][d%2]:
                    yield int(left + mid + right)
    def a(n):
        for p in pals(startd=len(str(2**n-1))):
            if bin(p).count("1") == n:
                return p
    print([a(n) for n in range(33)]) # Michael S. Branicky, Jun 02 2022

Extensions

a(21)-a(32) from Michael S. Branicky, Jun 02 2022
Showing 1-8 of 8 results.