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.

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