login
A259019
Lexicographically first permutation of the nonnegative integers such that Sum_{k=n..2n} a(k) is a prime number, with a(1)=0.
0
0, 2, 1, 4, 3, 5, 6, 11, 7, 9, 8, 13, 10, 15, 12, 16, 14, 23, 17, 20, 18, 25, 19, 21, 22, 31, 24, 30, 26, 29, 27, 35, 28, 34, 32, 38, 33, 48, 36, 37, 39, 41, 40, 44, 42, 53, 43, 50, 45, 46, 47, 55, 49, 52, 51, 57, 54, 66, 56, 60, 58, 63, 59, 62, 61, 78, 64, 84
OFFSET
1,2
COMMENTS
Previous name: a(1)=0; for n>1, a(n) is the least number not yet used having the property that a(n) added with the next n terms is a prime number.
The corresponding primes are 2, 7, 13, 29, 41, 59, 79, 101, 127, 157, 191, 223, 263, 307, 347, 397, 443, 499, 557, 613, 673, 739, 809, 883, 953, 1033, 1103, 1187, 1277, 1367, 1459, 1553, 1657, 1777, ...
This is a permutation of the integers. - Michel Marcus, Jun 21 2015
EXAMPLE
a(1)= 0 plus the next single term 2 is 2 (a prime);
a(2)= 2 plus the next two terms (1,4) is 7 (a prime);
a(3)= 1 plus the next three terms (4,3,5) is 13 (a prime);
a(4)= 4 plus the next four terms (3,5,6,11) is 29 (a prime);
a(5)= 3 plus the next five terms (5,6,11,7,9) is 41 (a prime).
MAPLE
nn:=100:T:=array(1..nn):T[1]:=0:T[2]:=2:kk:=2:lst:={0, 2}:
for n from 2 to nn do:
ii:=0:
for k from 1 to 1000 while(ii=0)do:
if {k} intersect lst = {}
then
ii:=1:lst:=lst union {k}:kk:=kk+1:T[kk]:=k:
else
fi:
od:
jj:=0:n0:=nops(lst):s:=sum('T[i]', 'i'=n..n0):
for p from 1 to 100 while(jj=0) do:
z:=s+p:
if type(z, prime)=true and {p} intersect lst={}
then
jj:=1:lst:=lst union {p}:kk:=kk+1:T[kk]:=p:
else
fi:
od:
od:
print(T):
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Jun 16 2015
EXTENSIONS
Name edited by Jon E. Schoenfield, Sep 12 2017
STATUS
approved