A332941 Lexicographically earliest sequence of positive numbers in which no set of consecutive terms sums to a prime.
1, 8, 1, 15, 9, 1, 14, 6, 30, 6, 9, 15, 6, 4, 8, 12, 10, 14, 6, 12, 8, 10, 12, 18, 12, 6, 6, 6, 24, 6, 6, 8, 1, 9, 6, 10, 8, 12, 6, 14, 10, 6, 4, 8, 12, 10, 20, 6, 18, 6, 6, 4, 8, 12, 6, 4, 12, 8, 10, 8, 6, 6, 18, 6, 6, 20, 10, 12, 8, 4, 6, 12, 12, 6, 12, 6, 12
Offset: 1
Keywords
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..10000
Programs
-
Maple
s:= proc(i, j) option remember; `if`(i>j, 0, a(j)+s(i, j-1)) end: a:= proc(n) option remember; local k; for k while ormap(isprime, [k+s(i, n-1)$i=1..n]) do od; k end: seq(a(n), n=1..100); # Alois P. Heinz, Mar 23 2020
-
Mathematica
s[i_, j_] := s[i, j] = If[i > j, 0, a[j] + s[i, j-1]]; a[n_] := a[n] = Module[{k}, For[k = 1, AnyTrue[k+Table[s[i, n-1], {i, 1, n}], PrimeQ], k++]; k]; Array[a, 100] (* Jean-François Alcover, Nov 17 2020, after Alois P. Heinz *)
-
Python
def A(ee): a=[1] print(1) n=1 while n<=ee: i=1 while i>0: ii=i iz=c=0 while iz<=len(a): c=0 if ii>2: for j in range(2, int((ii)**0.5+1.5)): if ii%j==0: c=1 break if c==0 and ii>1: break else: iz += 1 ii=ii+a[n-iz] if c==1: n += 1 a.append(i) print(i) break if i<4: i=4 else: i += 1 return a
Comments