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-6 of 6 results.

A030130 Binary expansion contains a single 0.

Original entry on oeis.org

0, 2, 5, 6, 11, 13, 14, 23, 27, 29, 30, 47, 55, 59, 61, 62, 95, 111, 119, 123, 125, 126, 191, 223, 239, 247, 251, 253, 254, 383, 447, 479, 495, 503, 507, 509, 510, 767, 895, 959, 991, 1007, 1015, 1019, 1021, 1022, 1535, 1791, 1919, 1983, 2015, 2031, 2039
Offset: 1

Views

Author

Toby Donaldson (tjdonald(AT)uwaterloo.ca)

Keywords

Comments

From Reinhard Zumkeller, Aug 29 2009: (Start)
A023416(a(n)) = 1;
apart from the initial term the sequence can be seen as a triangle read by rows, see A164874;
A055010 and A086224 are subsequences, see also A000918 and A036563. (End)
Zero and numbers of form 2^m-2^k-1, 2 <= m, 0 <= k <= m-2. - Zak Seidov, Aug 06 2010

Examples

			23 is OK because it is '10111' in base 2.
		

Crossrefs

Programs

  • C
    long int element (long int i) { return (pow(2,g(i))-1-pow(2,(pow(2*g(i)-1,2)-1-8*i)/8));} long int g(long int m) {if (m==0) return(1); return ((sqrt(8*m-7)+3)/2);}
    
  • Haskell
    a030130 n = a030130_list !! (n-1)
    a030130_list = filter ((== 1) . a023416) [0..]
    -- Reinhard Zumkeller, Mar 31 2015, Dec 07 2012
    
  • Magma
    [0] cat [k:k in [0..2050]| Multiplicity(Intseq(k,2),0) eq 1]; // Marius A. Burtea, Feb 06 2020
    
  • Mathematica
    Sort[Flatten[{{0}, Table[2^n - 2^m - 1, {n, 2, 50}, {m, 0, n - 2}]}]] (* Zak Seidov, Aug 06 2010 *)
    Select[Range[0,2100],DigitCount[#,2,0]==1&] (* Harvey P. Dale, Dec 19 2021 *)
  • PARI
    print1("0, ");for(k=1,2039,my(v=digits(k,2));if(vecsum(v)==#v-1,print1(k,", "))) \\ Hugo Pfoertner, Feb 06 2020
    
  • Python
    from math import isqrt, comb
    def A030130(n): return (1<<(a:=(isqrt(n-1<<3)+1>>1)+1))-(1<Chai Wah Wu, Dec 19 2024

Formula

a(n) = 2^(g(n))-1-2^(((2*g(n)-1)^2-1-8*n)/8) with g(n)=int((sqrt(8*n-7)+3)/2) for all n>0 and g(0)=1. - Ulrich Schimke (ulrschimke(AT)aol.com)
a(n+1) = A140977(a(n)) for any n > 1. - Rémy Sigrist, Feb 06 2020
Sum_{n>=2} 1/a(n) = A160502. - Amiram Eldar, Oct 06 2020
a(n) = (A190620(n-1)-1)/2. - Chai Wah Wu, Dec 19 2024

Extensions

More terms from Erich Friedman
Offset fixed by Reinhard Zumkeller, Aug 24 2009

A357773 Odd numbers with two zeros in their binary expansion.

Original entry on oeis.org

9, 19, 21, 25, 39, 43, 45, 51, 53, 57, 79, 87, 91, 93, 103, 107, 109, 115, 117, 121, 159, 175, 183, 187, 189, 207, 215, 219, 221, 231, 235, 237, 243, 245, 249, 319, 351, 367, 375, 379, 381, 415, 431, 439, 443, 445, 463, 471, 475, 477, 487, 491, 493, 499, 501
Offset: 1

Views

Author

Bernard Schott, Oct 12 2022

Keywords

Comments

A048490 \ {1} is a subsequence, since for m >= 1, A048490(m) = 8*2^m - 7 has 11..11001 with m starting 1 for binary expansion.
A153894 \ {4} is a subsequence, since for m >= 1, A153894(m) = 5*2^m - 1 has 10011..11 with m trailing 1 for binary expansion.
A220236 is a subsequence, since for m >= 1, A220236(m) = 2^(2*m + 2) - 2^(m + 1) - 2^m - 1 has 11..110011..11 with m starting 1 and m trailing 1 for binary expansion.
For k > 2, there are (k-1)*(k-2)/2 terms between 2^k and 2^(k+1), or equivalently (k-1)*(k-2)/2 terms with k+1 bits.
Binary expansion of a(n) is A357774(n).
{4*a(n), n>0} form a subsequence of A353654 (numbers with two trailing 0 bits and two other 0 bits).

Crossrefs

Odd numbers with k zeros in their binary expansion: A000225 (k=0), A190620 (k=1).
Subsequences: A048490 \ {1}, A153894 \ {4}, A220236.

Programs

  • Maple
    seq(seq(seq(2^n-1-2^i-2^j,j=i-1..1,-1),i=n-2..1,-1),n=4..10); # Robert Israel, Oct 13 2022
  • Mathematica
    Select[Range[1, 500, 2], DigitCount[#, 2, 0] == 2 &] (* Amiram Eldar, Oct 12 2022 *)
  • PARI
    isok(k) = (k%2) && (#binary(k) == hammingweight(k)+2); \\ Michel Marcus, Oct 13 2022
    
  • PARI
    list(lim)=my(v=List()); for(n=4,logint(lim\=1,2)+1, my(N=2^n-1); forstep(a=n-2,2,-1, my(A=N-1<lim, break(2)); listput(v,t)))); Vec(v) \\ Charles R Greathouse IV, Oct 21 2022
  • Python
    def a(n):
        m = 0
        while m*(m+1)*(m+2)//6 <= n: m += 1
        m -= 1 # m = A056556(n-1)
        k, r, j = m + 4, n - m*(m+1)*(m+2)//6, 0
        while r >= 0: r -= (m+1-j); j += 1
        j += 1
        return 2**k - 2**(k-j) - 2**(-r) - 1
    print([a(n) for n in range(60)]) # Michael S. Branicky, Oct 12 2022
    
  • Python
    # faster version for generating initial segment of sequence
    from itertools import combinations, count, islice
    def agen():
        for d in count(4):
            b, c = 2**d - 1, 2**(d-1)
            for i, j in combinations(range(1, d-1), 2):
                yield b - (c >> i) - (c >> j)
    print(list(islice(agen(), 60))) # Michael S. Branicky, Oct 13 2022
    
  • Python
    from math import comb, isqrt
    from sympy import integer_nthroot
    def A357773(n):
        a = (m:=integer_nthroot(6*n, 3)[0])+(n>comb(m+2,3))+3
        b = isqrt((j:=comb(a-1,3)-n+1)<<3)+3>>1
        c = j-comb((r:=isqrt(w:=j<<1))+(w>r*(r+1)),2)
        return (1<Chai Wah Wu, Dec 17 2024
    

Formula

A023416(a(n)) = 2.
a((n-1)*(n-2)*(n-3)/6 - (i-1)*(i-2)/2 - (j-1)) = 2^n - 2^i - 2^j - 1 for 1 <= j < i <= n-2. - Robert Israel, Oct 13 2022

Extensions

a(11) and beyond from Michael S. Branicky, Oct 12 2022

A095078 Primes with a single 0 bit in their binary expansion.

Original entry on oeis.org

2, 5, 11, 13, 23, 29, 47, 59, 61, 191, 223, 239, 251, 383, 479, 503, 509, 991, 1019, 1021, 2039, 3583, 3967, 4079, 4091, 4093, 6143, 15359, 16127, 16319, 16381, 63487, 65407, 65519, 129023, 131063, 245759, 253951, 261631, 261887, 262079
Offset: 1

Views

Author

Antti Karttunen, Jun 01 2004

Keywords

Comments

Except for the first value 2, the sequence gives the primes of the form 2^k -2^j -1 with 0 < j < k-1. If j=k-1 we obtain the Mersenne primes. - Pierre CAMI, May 19 2005
{2} UNION (A000040 INTERSECT A190620). - Chai Wah Wu, Dec 19 2024

Crossrefs

Intersection of A000040 and A030130. Cf. A095058, A190620.

Programs

  • Mathematica
    Select[Prime[Range[23000]],DigitCount[#,2,0]==1&] (* Harvey P. Dale, Nov 28 2019 *)
  • PARI
    forprime(p=2,262079,v=binary(p);s=0;for(k=1,#v,s+=v[k]);if(#v-s==1,print1(p,", "))) \\ Washington Bomfim, Jan 13 2011

A353654 Numbers whose binary expansion has the same number of trailing 0 bits as other 0 bits.

Original entry on oeis.org

1, 3, 7, 10, 15, 22, 26, 31, 36, 46, 54, 58, 63, 76, 84, 94, 100, 110, 118, 122, 127, 136, 156, 172, 180, 190, 204, 212, 222, 228, 238, 246, 250, 255, 280, 296, 316, 328, 348, 364, 372, 382, 392, 412, 428, 436, 446, 460, 468, 478, 484, 494, 502, 506, 511, 528, 568
Offset: 1

Views

Author

Mikhail Kurkov, Jul 15 2022

Keywords

Comments

Numbers k such that A007814(k) = A086784(k).
To reproduce the sequence through itself, use the following rule: if binary 1xyz is a term then so are 11xyz and 10xyz0 (except for 1 alone where 100 is not a term).
The number of terms with bit length k is equal to Fibonacci(k-1) for k > 1.
Conjecture: 2*A247648(n-1) + 1 with rewrite 1 -> 1, 01 -> 0 applied to binary expansion is the same as a(n) without trailing 0 bits in binary.
Odd terms are positive Mersenne numbers (A000225), because there is no 0 in their binary expansion. - Bernard Schott, Oct 12 2022

Crossrefs

Cf. A356385 (first differences).
Subsequences with same number k of trailing 0 bits and other 0 bits: A000225 (k=0), 2*A190620 (k=1), 4*A357773 (k=2), 8*A360573 (k=3).

Programs

  • Maple
    N:= 10: # for terms <= 2^N
    S:= {1};
    for d from 1 to N do
      for k from 0 to d/2-1 do
        B:= combinat:-choose([$k+1..d-2],k);
        S:= S union convert(map(proc(t) local s; 2^d - 2^k - add(2^(s),s=t) end proc,B),set);
    od od:
    sort(convert(S,list)); # Robert Israel, Sep 21 2023
  • Mathematica
    Join[{1}, Select[Range[2, 600], IntegerExponent[#, 2] == Floor[Log2[# - 1]] - DigitCount[# - 1, 2, 1] &]] (* Amiram Eldar, Jul 16 2022 *)
  • PARI
    isok(k) = if (k==1, 1, (logint(k-1, 2)-hammingweight(k-1) == valuation(k, 2))); \\ Michel Marcus, Jul 16 2022
    
  • Python
    from itertools import islice, count
    def A353654_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:(m:=(~n & n-1).bit_length()) == bin(n>>m)[2:].count('0'),count(max(startvalue,1)))
    A353654_list = list(islice(A353654_gen(),30)) # Chai Wah Wu, Oct 14 2022

Formula

a(n) = a(n-1) + A356385(n-1) for n > 1 with a(1) = 1.
Conjectured formulas: (Start)
a(n) = 2^g(n-1)*(h(n-1) + 2^A000523(h(n-1))*(2 - g(n-1))) for n > 2 with a(1) = 1, a(2) = 3 where f(n) = n - A130312(n), g(n) = [n > 2*f(n)] and where h(n) = a(f(n) + 1).
a(n) = 1 + 2^r(n-1) + Sum_{k=1..r(n-1)} (1 - g(s(n-1, k)))*2^(r(n-1) - k) for n > 1 with a(1) = 1 where r(n) = A072649(n) and where s(n, k) = f(s(n, k-1)) for n > 0, k > 1 with s(n, 1) = n.
a(n) = 2*(2 + Sum_{k=1..n-2} 2^(A213911(A280514(k)-1) + 1)) - 2^A200650(n) for n > 1 with a(1) = 1.
A025480(a(n)-1) = A348366(A343152(n-1)) for n > 1.
a(A000045(n)) = 2^(n-1) - 1 for n > 1. (End)

A360573 Odd numbers with exactly three zeros in their binary expansion.

Original entry on oeis.org

17, 35, 37, 41, 49, 71, 75, 77, 83, 85, 89, 99, 101, 105, 113, 143, 151, 155, 157, 167, 171, 173, 179, 181, 185, 199, 203, 205, 211, 213, 217, 227, 229, 233, 241, 287, 303, 311, 315, 317, 335, 343, 347, 349, 359, 363, 365, 371, 373, 377, 399, 407, 411, 413
Offset: 1

Views

Author

Bernard Schott, Feb 12 2023

Keywords

Comments

If m is a term then 2*m+1 is another term, since if M is the binary expansion of m, then M.1 where . stands for concatenation is the binary expansion of 2*m+1.
A052996 \ {1,3,8} is a subsequence, since for m >= 3, A052996(m) = 9*2^(m-2) - 1 has 100011..11 with m-2 trailing 1 for binary expansion.
A171389 \ {20} is a subsequence, since for m >= 1, A171389(m) = 21*2^m - 1 has 1010011..11 with m trailing 1 for binary expansion.
A198276 \ {18} is a subsequence, since for m >= 1, A198276(m) = 19*2^m - 1 has 1001011..11 with m trailing 1 for binary expansion.
Binary expansion of a(n) is A360574(n).
{8*a(n), n>0} form a subsequence of A353654 (numbers with three trailing 0 bits and three other 0 bits).
Numbers of the form 2^(a+1) - 2^b - 2^c - 2^d - 1 where a > b > c > d > 0. - Robert Israel, Feb 13 2023

Examples

			35_10 = 100011_2, so 35 is a term.
		

Crossrefs

Subsequences: A052996 \ {1,3,8}, A171389 \ {20}, A198276 \ {18}.
Odd numbers with k zeros in their binary expansion: A000225 (k=0), A190620 (k=1), A357773 (k=2), this sequence (k=3).

Programs

  • Maple
    q:= n-> n::odd and add(1-i, i=Bits[Split](n))=3:
    select(q, [$1..575])[];  # Alois P. Heinz, Feb 12 2023
    # Alternative:
    [seq(seq(seq(seq(2^(a+1) - 2^b - 2^c - 2^d - 1, d = c-1..1,-1), c=b-1..2,-1),b=a-1..3,-1),a=4..12)]; # Robert Israel, Feb 13 2023
  • Mathematica
    Select[Range[1, 500, 2], DigitCount[#, 2, 0] == 3 &] (* Amiram Eldar, Feb 12 2023 *)
  • PARI
    isok(m) = (m%2) && #select(x->(x==0), binary(m)) == 3; \\ Michel Marcus, Feb 13 2023
  • Python
    def ok(n): return n&1 and bin(n)[2:].count("0") == 3
    print([k for k in range(414) if ok(k)]) # Michael S. Branicky, Feb 12 2023
    
  • Python
    from itertools import count, islice
    from sympy.utilities.iterables import multiset_permutations
    def A360573_gen(): # generator of terms
        yield from (int('1'+''.join(d)+'1',2) for l in count(0) for d in  multiset_permutations('000'+'1'*l))
    A360573_list = list(islice(A360573_gen(),54)) # Chai Wah Wu, Feb 18 2023
    
  • Python
    from itertools import combinations, count, islice
    def agen(): yield from ((1<Michael S. Branicky, Feb 18 2023
    
  • Python
    from math import comb, isqrt
    from sympy import integer_nthroot
    def A056557(n): return (k:=isqrt(r:=n+1-comb((m:=integer_nthroot(6*(n+1), 3)[0])-(nA333516(n): return (r:=n-1-comb((m:=integer_nthroot(6*n, 3)[0])+(n>comb(m+2, 3))+1, 3))-comb((k:=isqrt(m:=r+1<<1))+(m>k*(k+1)), 2)+1
    def A360010(n): return (m:=integer_nthroot(6*n, 3)[0])+(n>comb(m+2, 3))
    def A360573(n):
        a = (a2:=integer_nthroot(24*n, 4)[0])+(n>comb(a2+2, 4))+3
        j = comb(a-1,4)-n
        b, c, d = A360010(j+1)+2, A056557(j)+2, A333516(j+1)
        return (1<Chai Wah Wu, Dec 18 2024
    

Formula

A023416(a(n)) = 3.
Let a = floor((24n)^(1/4))+4 if n>binomial(floor((24n)^(1/4))+2,4) and a = floor((24n)^(1/4))+3 otherwise. Let j = binomial(a-1,4)-n. Then a(n) = 2^a-1-2^(A360010(j+1)+2)-2^(A056557(j)+2)-2^(A333516(j+1)). - Chai Wah Wu, Dec 18 2024

A190619 Binary expansions of odd numbers with a single zero in their binary expansion.

Original entry on oeis.org

101, 1011, 1101, 10111, 11011, 11101, 101111, 110111, 111011, 111101, 1011111, 1101111, 1110111, 1111011, 1111101, 10111111, 11011111, 11101111, 11110111, 11111011, 11111101, 101111111, 110111111, 111011111, 111101111, 111110111, 111111011, 111111101, 1011111111, 1101111111, 1110111111, 1111011111, 1111101111, 1111110111, 1111111011, 1111111101
Offset: 1

Views

Author

N. J. A. Sloane, May 14 2011

Keywords

Comments

a(n) = A007088(A190620(n)). [Reinhard Zumkeller, May 14 2011]

Programs

  • Haskell
    a190619 n = a190619_list !! (n-1)
    a190619_list = map read $ f 2 1 :: [Integer] where
      f m k
        | k < m - 1 = ((take k ones) ++ "0" ++ (take (m-k) ones)) : f m (k+1)
        | otherwise = ((take k ones) ++ "01") : f (m + 1) 1
      ones = repeat '1'
    -- Reinhard Zumkeller, May 15 2011
    
  • Maple
    f:=k->(10^k-1)/9; for n from 3 to 12 do for i from n-2 by -1 to 1 do j:=f(n)-10^i; lprint(j); od; od;
  • Python
    from itertools import count, islice
    def agen():
        for d in count(3):
            b = (10**d - 1)//9
            for i in range(2, d):
                yield b - 10**(d-i)
    print(list(islice(agen(), 50))) # Michael S. Branicky, Oct 13 2022
    
  • Python
    from math import isqrt, comb
    def A190619(n): return (10**((a:=(isqrt(n<<3)+1>>1)+1)+1)-1)//9-10**(comb(a,2)-n+1) # Chai Wah Wu, Dec 18 2024
Showing 1-6 of 6 results.