login
A259018
Lexicographically first permutation of the nonnegative integers such that Sum_{k=n..2n} a(k) is a square, starting with a(1)=0.
1
0, 1, 2, 6, 3, 5, 4, 7, 8, 9, 10, 21, 11, 30, 12, 13, 14, 16, 15, 18, 17, 19, 20, 50, 22, 32, 23, 60, 24, 45, 25, 28, 26, 75, 27, 34, 29, 36, 31, 35, 33, 38, 37, 92, 39, 100, 40, 43, 41, 74, 42, 47, 44, 57, 46, 48, 49, 84, 51, 52, 53, 90, 54, 55, 56, 58, 93, 59
OFFSET
1,3
COMMENTS
The corresponding squares are 1, 9, 16, 25, 36, 64, 100, 121, 144, 169, 196, 256, 289, 361, 400, 441, 529, 576, 625, 676, 729, 841, 961, 1024, 1089, 1156, 1225, 1296, 1369, ...
This is a permutation of the integers.
EXAMPLE
a(1) = 0 plus the next single term 1 is 1 = 1^2;
a(2) = 1 plus the next two terms (2,6) is 9 = 3^2;
a(3) = 2 plus the next three terms (6,3,5) is 16 = 4^2;
a(4) = 6 plus the next four terms (3,5,4,7) is 25 = 5^2.
MAPLE
nn:=100:T:=array(1..nn):T[1]:=0:T[2]:=1:kk:=2:lst:={0, 1}:
for n from 2 to nn do:
ii:=0:
for k from 2 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:=sqrt(s+p):
if z = floor(z) and {p} intersect lst={}
then
jj:=1:lst:=lst union {p}:kk:=kk+1:T[kk]:=p:
else
fi:
od:
od:
print(T):
CROSSREFS
Sequence in context: A258252 A351496 A154048 * A353649 A084355 A093650
KEYWORD
nonn
AUTHOR
Michel Lagneau, Jun 16 2015
STATUS
approved