cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A259018 Lexicographically first permutation of the nonnegative integers such that Sum_{k=n..2n} a(k) is a square, starting with a(1)=0.

This page as a plain text file.
%I A259018 #16 Sep 12 2017 21:31:23
%S A259018 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,
%T A259018 23,60,24,45,25,28,26,75,27,34,29,36,31,35,33,38,37,92,39,100,40,43,
%U A259018 41,74,42,47,44,57,46,48,49,84,51,52,53,90,54,55,56,58,93,59
%N A259018 Lexicographically first permutation of the nonnegative integers such that Sum_{k=n..2n} a(k) is a square, starting with a(1)=0.
%C A259018 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, ...
%C A259018 This is a permutation of the integers.
%H A259018 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%e A259018 a(1) = 0 plus the next single term 1 is 1 = 1^2;
%e A259018 a(2) = 1 plus the next two terms (2,6) is 9 = 3^2;
%e A259018 a(3) = 2 plus the next three terms (6,3,5) is 16 = 4^2;
%e A259018 a(4) = 6 plus the next four terms (3,5,4,7) is 25 = 5^2.
%p A259018 nn:=100:T:=array(1..nn):T[1]:=0:T[2]:=1:kk:=2:lst:={0,1}:
%p A259018 for n from 2 to nn do:
%p A259018   ii:=0:
%p A259018     for k from 2 to 1000 while(ii=0)do:
%p A259018      if {k} intersect lst = {}
%p A259018      then
%p A259018      ii:=1:lst:=lst union {k}:kk:=kk+1:T[kk]:=k:
%p A259018      else
%p A259018      fi:
%p A259018     od:
%p A259018      jj:=0:n0:=nops(lst):s:=sum('T[i]', 'i'=n..n0):
%p A259018       for p from 1 to 100 while(jj=0) do:
%p A259018         z:=sqrt(s+p):
%p A259018          if z = floor(z) and {p} intersect lst={}
%p A259018          then
%p A259018          jj:=1:lst:=lst union {p}:kk:=kk+1:T[kk]:=p:
%p A259018          else
%p A259018          fi:
%p A259018        od:
%p A259018 od:
%p A259018 print(T):
%Y A259018 Cf. A000290, A247665.
%K A259018 nonn
%O A259018 1,3
%A A259018 _Michel Lagneau_, Jun 16 2015