login
Rightmost terms of the triangle A097825.
2

%I #11 Aug 17 2017 02:58:08

%S 1,1,1,4,3,4,7,2,8,2,4,8,2,12,8,11,12,11,16,11,17,3,17,5,17,7,13,15,1,

%T 30,3,30,5,30,13,24,27,12,31,10,35,8,39,6,26,20,22,26,20,30,18,34,16,

%U 38,10,49,12,49,14,49,22,43,24,43,26,43,63,3,63,5,57,13,57,15,57,17,51,25

%N Rightmost terms of the triangle A097825.

%p p:=proc(n) local B,k,u,rev,w; with(linalg):u:=n->[seq(i,i=1..n)]; rev:=proc(a) [seq(a[nops(a)+1-i],i=1..nops(a))] end; w:=(m,n)->[seq(i,i=m..n)]; B[0]:=matrix(1,n,u(n)): if n mod 2 = 0 then for k from 1 to n/2 do B[2*k-1]:=concat(submatrix(B[2*k-2],[1],rev(u(2*k-1))),submatrix(B[2*k-2],[1],w(2*k,n))): B[2*k]:=concat(submatrix(B[2*k-1],[1],u(n-2*k)),submatrix(B[2*k-1],[1],rev(w(n+1-2*k,n)))) od else for k from 1 to (n-1)/2 do B[2*k-1]:=concat(submatrix(B[2*k-2],[1],rev(u(2*k-1))),submatrix(B[2*k-2],[1],w(2*k,n))): B[2*k]:=concat(submatrix(B[2*k-1],[1],u(n-2*k)),submatrix(B[2*k-1],[1],rev(w(n+1-2*k,n)))) od: B[n]:=concat(submatrix(B[n-1],[1],rev(u(n))),submatrix(B[n-1],[1],[])) fi end:seq(p(i)[1,i],i=1..89); # _Emeric Deutsch_, Feb 27 2005

%Y Cf. A097825.

%K easy,nonn

%O 1,4

%A _Leroy Quet_, Aug 26 2004

%E More terms from _Emeric Deutsch_, Feb 27 2005