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.

A190620 Odd numbers with a single zero in their binary expansion.

This page as a plain text file.
%I A190620 #62 Dec 18 2024 12:32:35
%S A190620 5,11,13,23,27,29,47,55,59,61,95,111,119,123,125,191,223,239,247,251,
%T A190620 253,383,447,479,495,503,507,509,767,895,959,991,1007,1015,1019,1021,
%U A190620 1535,1791,1919,1983,2015,2031,2039,2043,2045,3071,3583,3839,3967,4031
%N A190620 Odd numbers with a single zero in their binary expansion.
%C A190620 Odd numbers such that the binary weight is one less than the number of significant digits. Except for the initial 0, A129868 is a subsequence of this sequence. - _Alonso del Arte_, May 14 2011
%C A190620 From _Bernard Schott_, Oct 20 2022: (Start)
%C A190620 A036563 \ {-2, -1, 1} is a subsequence, since for m >= 3, A036563(m) = 2^m - 3 has 11..1101 with (m-2) starting 1's for binary expansion.
%C A190620 A083329 \ {1, 2} is a subsequence, since for m >= 2, A083329(m) = 3*2^(m-1) - 1 has 1011..11 with (m-1) trailing 1's for binary expansion.
%C A190620 A129868 \ {0} is a subsequence, since for m >= 1, A129868(m) = 2*4^m - 2^m - 1 is a binary cyclops number that has 11..11011..11 with m starting 1's and m trailing 1's for binary expansion.
%C A190620 The 0-bit position in binary expansion of a(n) is at rank A004736(n) + 1 from the right.
%C A190620 For k >= 2, there are (k-1) terms between 2^k and 2^(k+1), or equivalently (k-1) terms with (k+1) bits.
%C A190620 {2*a(n), n>0} form a subsequence of A353654 (numbers with one trailing 0 bit and one other 0 bit). (End)
%H A190620 Reinhard Zumkeller, <a href="/A190620/b190620.txt">Table of n, a(n) for n = 1..10000</a>
%F A190620 A190619(n) = A007088(a(n));
%F A190620 A023416(a(n)) = 1.
%F A190620 From _Bernard Schott_, Oct 21 2022: (Start)
%F A190620 a((n-1)*(n-2)/2 - (i-1)) = 2^n - 2^i - 1 for n >= 3 and 1 <= i <= n-2 (after _Robert Israel_ in A357773).
%F A190620 a(n) = A000225(A002024(n)+2) - A000079(A004736(n)).
%F A190620 a(n) = 4*2^k(n) - 2^(1 - n + (k(n) + k(n)^2)/2) - 1, where k is the Kruskal-Macaulay function A123578.
%F A190620 A070939(a(n)) = A002024(n) + 2. (End)
%p A190620 isA := proc(n) convert(n, base, 2): %[1] = nops(%) - add(%) end:
%p A190620 select(isA, [$1..4031]); # _Peter Luschny_, Oct 27 2022
%p A190620 # Alternatively, using a formula of _Bernard Schott_ and A123578:
%p A190620 A190620 := proc(n) A123578(n); 4*2^% - 2^(1 - n + (% + %^2)/2) - 1 end:
%p A190620 seq(A190620(n), n = 1..50); # _Peter Luschny_, Oct 28 2022
%t A190620 Select[Range[1,5001,2],DigitCount[#,2,0]==1&] (* _Harvey P. Dale_, Jul 12 2018 *)
%o A190620 (Haskell)
%o A190620 import Data.List (elemIndices)
%o A190620 a190620 n = a190620_list !! (n-1)
%o A190620 a190620_list = filter odd $ elemIndices 1 a023416_list
%o A190620 -- A more efficient version, inspired by the Maple program in A190619:
%o A190620 a190620_list' = g 8 2 where
%o A190620    g m 2 = (m - 3) : g (2*m) (m `div` 2)
%o A190620    g m k = (m - k - 1) : g m (k `div` 2)
%o A190620 (Python)
%o A190620 from itertools import count, islice
%o A190620 def agen():
%o A190620     for d in count(3):
%o A190620         b = 1 << d
%o A190620         for i in range(2, d):
%o A190620             yield b - (b >> i) - 1
%o A190620 print(list(islice(agen(), 50))) # _Michael S. Branicky_, Oct 13 2022
%o A190620 (Python)
%o A190620 from math import isqrt, comb
%o A190620 def A190620(n): return (1<<(a:=(isqrt(n<<3)+1>>1)+1)+1)-(1<<comb(a,2)-n+1)-1 # _Chai Wah Wu_, Dec 18 2024
%Y A190620 Cf. A007088, A023416, A190619, A353654.
%Y A190620 A036563 \ {-2, -1, 1}, A083329 \ {1, 2}, A129868 are subsequences.
%Y A190620 Odd numbers with k zeros in their binary expansion: A000225 (k=0), A357773 (k=2).
%K A190620 nonn,base
%O A190620 1,1
%A A190620 _Reinhard Zumkeller_, May 14 2011