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.

A354141 Indices of terms in A352808 that are powers of 2.

This page as a plain text file.
%I A354141 #25 May 21 2022 14:53:17
%S A354141 1,2,3,5,9,22,31,61,121,247,479,951,1862,3802,7431,15180,29723,59766,
%T A354141 118893,239999,475573,959341,1902293,3835229,7609175,15268473,
%U A354141 30436701,61001391
%N A354141 Indices of terms in A352808 that are powers of 2.
%C A354141 Every power of 2 will eventually appear in A353730, so the sequence is infinite.
%H A354141 Rémy Sigrist, <a href="/A354141/a354141.txt">C++ program</a>
%o A354141 (Python)
%o A354141 from itertools import count, islice
%o A354141 def ispow2(k): return bin(k).count("1") == 1
%o A354141 def agen(): # generator of terms
%o A354141     A352808lst = [0, 1]; A352808set = {0, 1}
%o A354141     k, mink, p = 1, 2, 2
%o A354141     for n in count(2):
%o A354141         if ispow2(k): yield n-1
%o A354141         ahalf, k = A352808lst[n//2], mink
%o A354141         while k in A352808set or k&ahalf: k += 1
%o A354141         A352808lst.append(k); A352808set.add(k)
%o A354141         while mink in A352808set: mink += 1
%o A354141 print(list(islice(agen(), 8))) # _Michael S. Branicky_, May 18 2022
%o A354141 (C++) See Links section.
%Y A354141 Cf. A352808, A353734.
%K A354141 nonn,more
%O A354141 1,2
%A A354141 _N. J. A. Sloane_, May 18 2022
%E A354141 a(16)-a(22) from _Michael S. Branicky_, May 19 2022
%E A354141 a(23)-a(28) from _Rémy Sigrist_, May 21 2022