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