from math import sqrt
from itertools import product

start = 3
end = 709

def premiers(n):
  prem=list(range(2,n+1))
  k=2
  nRacine=sqrt(n)
  while k<nRacine:
    prem=[p for p in prem if p<=k or p%k!=0]
    k=prem[prem.index(k)+1]  # nouveau nombre premier
  return prem


prem = premiers(end)
table = list(product(prem, repeat=2))

next_even = True #Even = Pair and Odd = Impair :)

suite = [start, ]
max_len = 1

while suite[-1] < end:
    pos = suite[-1] + 1

    if next_even:
        while True:
            res = set()
            for i in range(len(table)):
                pair = table[i]
                if pos == pair[0]+pair[1]:
                    res.add((min(pair), max(pair)))
            if len(res)%2 == 1:
                break
            pos+=2
        
        next_even = False
    else:
        while True:
            if pos in prem:
                break
            pos+=2

        next_even = True

    max_len = max(max_len, abs(pos-suite[-1]))
    suite.append(pos)


print(suite)
print(len(suite), max_len)