%I #13 Jan 13 2016 03:12:39
%S 2,1,5,4,3,10,9,8,7,6,17,16,15,14,13,12,11,26,25,24,23,22,21,20,19,18,
%T 37,36,35,34,33,32,31,30,29,28,27,50,49,48,47,46,45,44,43,42,41,40,39,
%U 38,65,64,63,62,61,60,59,58,57,56,55,54,53,52,51,82
%N Sequences has the properties shown in the Comments lines.
%C It contains an infinite increasing subsequence.
%C For each k there is a decreasing subsequence of length > k but no infinite decreasing subsequence.
%C For each n the first n^2 + 1 terms contain a decreasing subsequence of length n + 1 but no increasing subsequence of length n + 1.
%H Robert Israel, <a href="/A094064/b094064.txt">Table of n, a(n) for n = 0..10000</a>
%H P. Erdõs, G. Szekeres, <a href="http://www.renyi.hu/~p_erdos/1935-01.pdf">A combinatorial problem in geometry</a>, Compositio Math. 2 (1935), 463-470; Zentralblatt 12,270.
%H Lajos Pinter, <a href="http://www.jstor.org/stable/3621353">On monotone subsequences</a>, Math. Gaz., 88 (#511, 2004), 110-111.
%F G.f. (3 + 5*x^2 + 4*x*Sum_{n>=2} n*x^(n^2))/(1-x) - 1/(1-x)^2. - _Robert Israel_, Jan 13 2016
%p A[0]:= 2:
%p A[1]:= 1:
%p for n from 1 to 9 do
%p for i from 1 to 2*n+1 do
%p A[n^2+i]:= (n+1)^2+2-i
%p od od:
%p seq(A[i],i=0..100); # _Robert Israel_, Jan 13 2016
%K nonn
%O 0,1
%A _R. K. Guy_, May 01 2004