OFFSET
1,1
COMMENTS
The sequences A052349 and A068638 are composed of integers starting from one with the rule that no subsequence has a prime sum; these sequences start with one. Starting with a different number seems to result in straightforward geometric sequences, for example the sequence with no prime subsequence sums starting with four is 4, 6, 8, and so on. One way to avoid this is to enforce a coprime rule, requiring that the entries to the sequence are coprime. It is not clear whether the sequence is infinite.
MATHEMATICA
k = 4; K = {k}; f = {2}; q = Subsets[K]; While[Length@K < 10, k++; If[! PrimeQ[k] && ! IntersectingQ[FactorInteger[k][[All, 1]], f], s = k; z = 0; For[p = 1, p <= Length@q, p++, If[PrimeQ[Total[q[[p]]] + k], z = 1; Break[]]]; If[z == 0, AppendTo[K, k]; q = Subsets[K]; AppendTo[f, FactorInteger[k][[All, 1]]]; f = Flatten[f]]]]; Print[K] (* Samuel Harkness, Apr 11 2023 *)
PROG
(Python)
import sys
import math
from sympy.ntheory import primefactors
from sympy.ntheory import primerange
def intersection(lst1, lst2):
lst3 = [value for value in lst1 if value in lst2]
return len(lst3)
n_primes=1000000
factors=[primefactors(n) for n in range(0, n_primes)]
primes=list(primerange(0, n_primes))
sequence=[4]
sums=[sequence[0]]
prime_factors=[f for f in factors[sequence[0]]]
big_n=8
while len(sequence)<big_n:
new_a=False
a=sequence[-1]+1
while intersection(factors[a], prime_factors)!=0:
a+=1
n=len(sequence)
while not new_a:
new_sum=[a+sum for sum in sums]
prime_sum=False
for sum in new_sum:
if sum in primes:
prime_sum=True
if not prime_sum and a not in primes:
sequence.append(a)
print(a, end=", ")
sys.stdout.flush()
sums=sums+new_sum+[a]
sums = list(dict.fromkeys(sums))
prime_factors=prime_factors+factors[a]
new_a=True
else:
a+=1
while a in primes or intersection(factors[a], prime_factors)!=0:
a+=1
print()
(Python)
from math import gcd
from sympy import isprime
from itertools import islice
def agen(start=4): # generator of terms
alst, k, sums = [start], start+1, {0} | {start}
while True:
yield alst[-1]
while any(gcd(k, an) != 1 for an in alst) or \
any(k+s not in sums and isprime(k+s) for s in sums):
k += 1
alst.append(k)
sums.update([k + s for s in sums])
k += 1
print(list(islice(agen(), 8))) # Michael S. Branicky, Dec 16 2022
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Conor Houghton, Dec 15 2022
EXTENSIONS
a(8)-a(9) from Michael S. Branicky, Dec 15 2022
a(10) from Rémy Sigrist, Dec 16 2022
STATUS
approved