login
Lexicographically first sequence of positive integers such that all terms are pairwise coprime and no subset sum is a power of 2.
1

%I #34 Jun 14 2023 18:41:49

%S 3,7,10,11,17,31,41,71,169,199,263,337,367,1553,2129,2287,2297,4351,

%T 10433,16391,16433,34829,65543,69557,165887,262151,358481,817153,

%U 952319,1048583,3704737,3932167,4518071,12582919,17305417,17367019,50069497,50593799,87228517

%N Lexicographically first sequence of positive integers such that all terms are pairwise coprime and no subset sum is a power of 2.

%H Jon E. Schoenfield, <a href="/A363245/a363245.txt">Magma program</a> (computes first 36 terms).

%t a = {3}; k = 2; Monitor[Do[While[Or[! Apply[CoprimeQ, Join[a, {k}]], AnyTrue[Map[Log2 @* Total@ Append[#, k] &, Subsets[a]], IntegerQ]], k++]; AppendTo[a, k]; k++, {i, 16}], {i, k}]; a (* _Michael De Vlieger_, Jun 14 2023 *)

%o (Python)

%o from math import gcd

%o from itertools import count, islice

%o def agen(): # generator of terms

%o a, ss, pows2, m = [], set(), {1, 2}, 2

%o for k in count(1):

%o if k in pows2: continue

%o elif k > m: m <<= 1; pows2.add(m)

%o if any(p2-k in ss for p2 in pows2): continue

%o if any(gcd(ai, k) != 1 for ai in a): continue

%o a.append(k); yield k

%o ss |= {k} | {k+si for si in ss if k+si not in ss}

%o while m < max(ss): m <<= 1; pows2.add(m)

%o print(list(islice(agen(), 30))) # _Michael S. Branicky_, Jun 09 2023

%Y Cf. A353889.

%K nonn

%O 1,1

%A _Julian Zbigniew Kuryllowicz-Kazmierczak_, May 23 2023

%E a(23)-a(33) from _Michael S. Branicky_, Jun 07 2023

%E a(34)-a(39) from _Jon E. Schoenfield_, Jun 09 2023