|
|
A332941
|
|
Lexicographically earliest sequence of positive numbers in which no set of consecutive terms sums to a prime.
|
|
6
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
Terms >= 30 seem to be very rare. Up to a(450000), 30 appears only 7 times: at n = 9, 288, 2507, 15902, 54405, 242728, 425707.
For n <= 450000, the largest term is 32; it appears at n = 335308 and 370687.
|
|
LINKS
|
|
|
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:
|
|
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];
|
|
PROG
|
(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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|