login
A357773
Odd numbers with two zeros in their binary expansion.
4
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,1
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).
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
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 *)
PROG
(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
(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<<a); forstep(b=a-1, 1, -1, my(t=A-1<<b); if(t>lim, break(2)); listput(v, t)))); Vec(v) \\ Charles R Greathouse IV, Oct 21 2022
CROSSREFS
Odd numbers with k zeros in their binary expansion: A000225 (k=0), A190620 (k=1).
Subsequences: A048490 \ {1}, A153894 \ {4}, A220236.
Sequence in context: A157140 A244538 A242332 * A075981 A079368 A167529
KEYWORD
nonn,base,easy
AUTHOR
Bernard Schott, Oct 12 2022
EXTENSIONS
a(11) and beyond from Michael S. Branicky, Oct 12 2022
STATUS
approved