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.

This page as a plain text file.
%I A357773 #65 Dec 18 2024 09:27:29
%S A357773 9,19,21,25,39,43,45,51,53,57,79,87,91,93,103,107,109,115,117,121,159,
%T A357773 175,183,187,189,207,215,219,221,231,235,237,243,245,249,319,351,367,
%U A357773 375,379,381,415,431,439,443,445,463,471,475,477,487,491,493,499,501
%N A357773 Odd numbers with two zeros in their binary expansion.
%C A357773 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.
%C A357773 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.
%C A357773 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.
%C A357773 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.
%C A357773 Binary expansion of a(n) is A357774(n).
%C A357773 {4*a(n), n>0} form a subsequence of A353654 (numbers with two trailing 0 bits and two other 0 bits).
%F A357773 A023416(a(n)) = 2.
%F A357773 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
%p A357773 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
%t A357773 Select[Range[1, 500, 2], DigitCount[#, 2, 0] == 2 &] (* _Amiram Eldar_, Oct 12 2022 *)
%o A357773 (Python)
%o A357773 def a(n):
%o A357773     m = 0
%o A357773     while m*(m+1)*(m+2)//6 <= n: m += 1
%o A357773     m -= 1 # m = A056556(n-1)
%o A357773     k, r, j = m + 4, n - m*(m+1)*(m+2)//6, 0
%o A357773     while r >= 0: r -= (m+1-j); j += 1
%o A357773     j += 1
%o A357773     return 2**k - 2**(k-j) - 2**(-r) - 1
%o A357773 print([a(n) for n in range(60)]) # _Michael S. Branicky_, Oct 12 2022
%o A357773 (Python) # faster version for generating initial segment of sequence
%o A357773 from itertools import combinations, count, islice
%o A357773 def agen():
%o A357773     for d in count(4):
%o A357773         b, c = 2**d - 1, 2**(d-1)
%o A357773         for i, j in combinations(range(1, d-1), 2):
%o A357773             yield b - (c >> i) - (c >> j)
%o A357773 print(list(islice(agen(), 60))) # _Michael S. Branicky_, Oct 13 2022
%o A357773 (Python)
%o A357773 from math import comb, isqrt
%o A357773 from sympy import integer_nthroot
%o A357773 def A357773(n):
%o A357773     a = (m:=integer_nthroot(6*n, 3)[0])+(n>comb(m+2,3))+3
%o A357773     b = isqrt((j:=comb(a-1,3)-n+1)<<3)+3>>1
%o A357773     c = j-comb((r:=isqrt(w:=j<<1))+(w>r*(r+1)),2)
%o A357773     return (1<<a)-(1<<b)-(1<<c)-1 # _Chai Wah Wu_, Dec 17 2024
%o A357773 (PARI) isok(k) = (k%2) && (#binary(k) == hammingweight(k)+2); \\ _Michel Marcus_, Oct 13 2022
%o A357773 (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
%Y A357773 Cf. A018900, A005408, A023416, A353654, A357774.
%Y A357773 Odd numbers with k zeros in their binary expansion: A000225 (k=0), A190620 (k=1).
%Y A357773 Subsequences: A048490 \ {1}, A153894 \ {4}, A220236.
%K A357773 nonn,base,easy
%O A357773 1,1
%A A357773 _Bernard Schott_, Oct 12 2022
%E A357773 a(11) and beyond from _Michael S. Branicky_, Oct 12 2022