SetDirectory[NotebookDirectory[]];
<<RISC`HolonomicFunctions`;

HolonomicFunctions Package version 1.7.2 (04-Dec-2015)
written by Christoph Koutschan
Copyright 2007-2015, Research Institute for Symbolic Computation (RISC),
Johannes Kepler University, Linz, Austria

1. Introduction

(* Some definitions *)
mat[a_,n_]:=Table[a[i,j],{i,n},{j,n}];
det[a_,n_Integer]:=Expand[Det[mat[a,n]]];

2. The Maximal Eigenvalue Problem

(* The matrix B_n - λ A_n *)
ba[i_,j_]:=If[EvenQ[i+j],2((i-1)*(j-1)/(i+j-3)-λ/(i+j-1)),0];
TableForm[BA8=Expand[mat[ba,8]]]

Do[Print[Factor[det[ba,n]]],{n,10}]

3. Determinant Evaluation

Block decomposition

(* Block decomposition *)
BA8=BA8[[{1,3,5,7,2,4,6,8}]];
BA8=Transpose[(Transpose[BA8])[[{1,3,5,7,2,4,6,8}]]];
TableForm[BA8]

(* Define the matrix entries of A^{(0)} and A^{(1)}. *)
a0[i_,j_]:=(2i-1)*(2j-1)/(2i+2j-3)-λ/(2i+2j-1);
a1[i_,j_]:=4(i-1)*(j-1)/(2i+2j-5)-λ/(2i+2j-3);

(* Check formula for block determinant. *)
Table[Together[det[ba,n]/(2^n*det[a1,Ceiling[n/2]]*det[a0,Floor[n/2]])],{n,2,10}]

TableForm[mat[a0,8]]

TableForm[mat[a1,8]]

Theorem 3.1

ff[n_]:=With[{nu=Floor[n/2]},Sum[(-4)^(j-nu)*Pochhammer[2nu-2j+1,n]/(2j-2nu+n)!*λ^j,{j,0,nu}]];
h0[n_]:=1/2^n*Product[((i-1)!)^2/Pochhammer[i+1/2,n],{i,1,n}];
h1[n_]:=1/2^n*Product[((i-1)!)^2/Pochhammer[i-1/2,n],{i,1,n}];

(* Check the statement *)
Table[Together[det[a0,n]/((-1)^n*h0[n]*ff[2n])],{n,10}]
Table[Together[det[a1,n]/((-1)^n*h1[n]*λ*ff[2n-1])],{n,10}]

Corollary 3.2

Table[Together[det[aa,n]/(λ*ff[n]*ff[n-1])],{n,10}]

Lemma 3.3

p0[n_,j_]:=2^(2n+2j-3)*Pochhammer[3/2,2n-1]*Pochhammer[n+1/2,j-1]/(n-1)!/(2j-1)!*Sum[Sum[(-1)^(j+m)*Pochhammer[2m+1,2k]*λ^m/4^(m+k)/k!/(2m+k-n-j+2)!,{k,0,2n-2m-2}],{m,0,n-1}];
p1[n_,j_]:=4^(j-n)*(4n-3)!*Pochhammer[n-1/2,j-1]/(2n-2)!/(n-1)!/(2j-2)!*Sum[Sum[(-1)^(j+m)*Pochhammer[2m,2k]*λ^m/4^(m+k)/k!/(2m+k-n-j+2)!,{k,0,2n-2m-2}],{m,0,n-1}];

(* Check 0 (establishes initial conditions for later use) *)
TableForm[Table[Together[Sum[a0[i,j]*p0[n,j],{j,n}]/ff[2n]],{n,10},{i,n}]]

(* Check 1 (establishes initial conditions for later use) *)
TableForm[Table[Together[Sum[a1[i,j]*p1[n,j],{j,n}]/(λ*ff[2n-1])],{n,10},{i,n}]]

First case: identity with (Subscript[p, n,j]^((0)))

(* Creative telescoping for the double sum in the definition of p0 *)
Timing[
ann1=Annihilator[Sum[(-1)^(j+m)*Pochhammer[2m+1,2k]*λ^m/4^(m+k)/k!/(2m+k-n-j+2)!,{k,0,2n-2m-2}],{S[j],S[n],S[m]}];
{ann2,cert}=CreativeTelescoping[ann1,S[m]-1];
Support[ann2]
]

(* Look at the denominators in the certificates. *)
(* They contain the bad factor n-m, yielding division by zero when summing *)
(* ann2[[i]] + (S[n]-1)**cert[[i]] from m=0 to m=n-1, for i=1,2,3. *)
Factor[PolynomialLCM@@Flatten[Denominator[OrePolynomialListCoefficients[#]]&/@cert]]

(* Thus we restrict the summation range to m=n-2 and look for inhomogeneous contributions. *)
(* They all turn out to be zero, which implies that ann2 annihilates the double sum. *)
Do[
expr=(sum[#,{m,0,n-2}]&/@ApplyOreOperator[ann2[[ii]],s[j,n,m]])+With[{c=ApplyOreOperator[cert[[ii]],s[j,n,m]]},(c/.m->n-1)-(c/.m->0)];
expr=expr//.sum[a_*b_/;FreeQ[a,m],c_]->a*sum[b,c]/.
sum[s[jj_,nn_,mm_],{m,0,NN_}]:>SUM[jj,nn](* := sum[s[jj,nn,mm],{m,0,nn-1}] *)+If[NN-nn+1≥0,Sum[s[jj,nn,mm],{m,nn,NN}],-Sum[s[jj,nn,mm],{m,NN+1,nn-1}]];
smnd[j_,n_,m_]:=sum[(-1)^(j+m)*Pochhammer[2m+1,2k]*λ^m/4^(m+k)/k!/(2m+k-n-j+2)!,{k,0,Expand[2n-2m-2]}];
expr=expr/.s->smnd/.sum[s_,{k_,a_,b_}]/;IntegerQ[b-a]:>Sum[s,{k,a,b}];
expr={expr/.(sum|SUM)[__]->0,expr-(expr/.sum[__]->0),expr-(expr/.SUM[__]->0)};
inh=Quiet[FunctionExpand[expr[[1]]]+FullSimplify[expr[[2]]/.sum->Sum,1≤j≤n&&Element[{j,n},Integers]]];
Print["Inhomogeneous contribution to ann2[[",ii,"]]: ",inh];
,{ii,1,Length[ann2]}];

(* By including the hypergeometric prefactor, we get the annihilator of p0_{n,j}. *)
annp0=DFiniteTimes[Annihilator[2^(2n+2j-3)*Pochhammer[3/2,2n-1]*Pochhammer[n+1/2,j-1]/(n-1)!/(2j-1)!,{S[j],S[n]}],ann2];

Factor[annp0]

(* Check *)
test=ApplyOreOperator[annp0,p[n,j]];
Union[Flatten[Together[Table[test,{n,10},{j,n}]/.p->p0]]]

(* Creative telescoping for the left-hand side \sum_j a0_{i,j} p0_{n,j} *)
Timing[
annp0=ToOrePolynomial[Append[annp0,S[i]-1],OreAlgebra[S[i],S[j],S[n]]];
ann3=DFiniteTimes[Annihilator[a0[i,j],{S[i],S[j],S[n]}],annp0];
{annlhs0,cert}=CreativeTelescoping[ann3,S[j]-1];
]

(* Again, there are bad factors in the denominators, but only in the first certificate. *)
Factor[PolynomialLCM@@Denominator[OrePolynomialListCoefficients[#]]]&/@cert

(* This time, we solve the problem by using a different certificate. *)
(* We load it and show that is satisfies the telescopic relation. *)
cert0=<<"cert0.m";
Factor[PolynomialLCM@@Denominator[OrePolynomialListCoefficients[cert0]]]
OreReduce[annlhs0[[1]]+(S[j]-1)**cert0,ann3]

(* Hence annlhs0 annihilates the left-hand side \sum_j a0_{i,j} p0_{n,j}. *)
Factor[annlhs0]

(* Shape of the recurrence equations for lhs[i,n] *)
Support[annlhs0]

(* Which initial conditions have to be given when we want to compute lhs[i,n] for i<n *)
(* To show that lhs[i,n]=0 for all i<n, it suffices to show that it is zero for these particular choices. *)
(* But this has already been done above. *)
Select[AnnihilatorSingularities[annlhs0,{1,1},Assumptions->i<n],FreeQ[First[#],λ]&]

(* Derive the recurrence satisfied by lhs[n,n]. *)
Factor[lhsnn0=DFiniteSubstitute[annlhs0,{i->n}][[1]]]

(* Annihilator for F[2n] *)
Factor[annF2n=Annihilator[Sum[(-4)^(j-n)*Pochhammer[2n-2j+1,2n]/(2j)!*λ^j,{j,0,n}],S[n]]]

(* We want to prove that lhs[n,n] = F[2n]. *)
(* The recurrence operator for lhs[n,n] is a left multiple of the one for F[2n]. *)
(* Initial conditions have been compared above. *)
OreReduce[lhsnn0,annF2n]

Second case: identity with (Subscript[p, n,j]^((1)))

(* Creative telescoping for the double sum in the definition of p1 *)
Timing[
ann1=Annihilator[Sum[(-1)^(j+m)*Pochhammer[2m,2k]*λ^m/4^(m+k)/k!/(2m+k-n-j+2)!,{k,0,2n-2m-2}],{S[j],S[n],S[m]}];
{ann2,cert}=CreativeTelescoping[ann1,S[m]-1];
Support[ann2]
]

(* Look at the denominators in the certificates. *)
(* They contain the bad factor n-m, yielding division by zero when summing *)
(* ann2[[i]] + (S[n]-1)**cert[[i]] from m=0 to m=n-1, for i=1,2,3. *)
Factor[PolynomialLCM@@Flatten[Denominator[OrePolynomialListCoefficients[#]]&/@cert]]

(* Thus we restrict the summation range to m=n-2 and look for inhomogeneous contributions. *)
(* They all turn out to be zero, which implies that ann2 annihilates the double sum. *)
Do[
expr=(sum[#,{m,0,n-2}]&/@ApplyOreOperator[ann2[[ii]],s[j,n,m]])+With[{c=ApplyOreOperator[cert[[ii]],s[j,n,m]]},(c/.m->n-1)-(c/.m->0)];
expr=expr//.sum[a_*b_/;FreeQ[a,m],c_]->a*sum[b,c]/.
sum[s[jj_,nn_,mm_],{m,0,NN_}]:>SUM[jj,nn](* := sum[s[jj,nn,mm],{m,0,nn-1}] *)+If[NN-nn+1≥0,Sum[s[jj,nn,mm],{m,nn,NN}],-Sum[s[jj,nn,mm],{m,NN+1,nn-1}]];
smnd[j_,n_,m_]:=sum[(-1)^(j+m)*Pochhammer[2m,2k]*λ^m/4^(m+k)/k!/(2m+k-n-j+2)!,{k,0,Expand[2n-2m-2]}];
expr=expr/.s->smnd/.sum[s_,{k_,a_,b_}]/;IntegerQ[b-a]:>Sum[s,{k,a,b}];
expr={expr/.(sum|SUM)[__]->0,expr-(expr/.sum[__]->0),expr-(expr/.SUM[__]->0)};
inh=Quiet[FunctionExpand[expr[[1]]]+FullSimplify[expr[[2]]/.sum->Sum,1≤j≤n&&Element[{j,n},Integers]]];
Print["Inhomogeneous contribution to ann2[[",ii,"]]: ",inh];
,{ii,1,Length[ann2]}];

(* By including the hypergeometric prefactor, we get the annihilator of p1_{n,j}. *)
annp1=DFiniteTimes[Annihilator[4^(j-n)*(4n-3)!*Pochhammer[n-1/2,j-1]/(2n-2)!/(n-1)!/(2j-2)!,{S[j],S[n]}],ann2];
Factor[annp1]

(* Check *)
test=ApplyOreOperator[annp1,p[n,j]];
Union[Flatten[Together[Table[test,{n,10},{j,n}]/.p->p1]]]

(* Creative telescoping for the left-hand side \sum_j a1_{i,j} p1_{n,j} *)
Timing[
annp1=ToOrePolynomial[Append[annp1,S[i]-1],OreAlgebra[S[i],S[j],S[n]]];
ann3=DFiniteTimes[Annihilator[a1[i,j],{S[i],S[j],S[n]}],annp1];
{annlhs1,cert}=CreativeTelescoping[ann3,S[j]-1];
]

(* Again, there are bad factors in the denominators, but only in the first certificate. *)
Factor[PolynomialLCM@@Denominator[OrePolynomialListCoefficients[#]]]&/@cert

(* This time, we solve the problem by using a different certificate. *)
(* We load it and show that is satisfies the telescopic relation. *)
cert1=<<"cert1.m";
Factor[PolynomialLCM@@Denominator[OrePolynomialListCoefficients[cert1]]]
OreReduce[annlhs1[[1]]+(S[j]-1)**cert1,ann3]

(* Hence annlhs1 annihilates the left-hand side \sum_j a1_{i,j} p1_{n,j}. *)
Factor[annlhs1]

(* Shape of the recurrence equations for lhs[i,n] *)
Support[annlhs1]

(* Which initial conditions have to be given when we want to compute lhs[i,n] for i<n *)
(* To show that lhs[i,n]=0 for all i<n, it suffices to show that it is zero for these particular choices. *)
(* But this has already been done above. *)
Select[AnnihilatorSingularities[annlhs1,{1,1},Assumptions->i<n],FreeQ[First[#],λ]&]

(* Derive the recurrence satisfied by lhs[n,n]. *)
Factor[lhsnn1=DFiniteSubstitute[annlhs1,{i->n}][[1]]]

(* Annihilator for F[2n-1] *)
Factor[annF2n1=Annihilator[Sum[(-4)^(j-n+1)*Pochhammer[2n-2j-1,2n-1]/(2j+1)!*λ^j,{j,0,n-1}],S[n]]]

(* We want to prove that lhs[n,n] = F[2n-1]. *)
(* The recurrence operator for lhs[n,n] is a left multiple of the one for F[2n-1]. *)
(* Initial conditions have been compared above. *)
OreReduce[lhsnn1,annF2n1]

Lemma 3.4

We demonstrate how Zeilberger’s holonomic ansatz can be used to prove this lemma.
We do it only for the first determinant, the second one is analogous.

(* Create data for c_{n,j} *)
cc={{1}};
Do[
vec=First[RISC`LinearSystemSolver`LinSolveQ[Table[1/(2i+2j-1),{i,n-1},{j,n}]]];
AppendTo[cc,vec/Last[vec]];
,{n,2,20}];
cc=PadRight[cc];

Quiet[Get["Guess.m"]];

(* Guess a set of recurrence equations for c_{n,j} *)
guess=Flatten[GuessMultRE[cc,{c[n,j],#},{n,j},3,StartPoint->{1,1},Constraints->j≤n]&/@{c[n+1,j],c[n,j+1]}]

(* Compute a Groebner basis for the annihilator of c_{n,j} *)
annc=OreGroebnerBasis[ToOrePolynomial[guess,c[n,j]]]

(* Recurrence for c_{n,n}. This shows that c_{n,n}=1 for all n. *)
DFiniteSubstitute[annc,{j->n}]

(* Creative telescoping for sum_{j=1}^n a_{i,j}*c_{n,j} *)
{annsum,cert}=CreativeTelescoping[DFiniteTimes[Annihilator[-1/(2i+2j-1),{S[n],S[i],S[j]}],ToOrePolynomial[Append[annc,S[i]-1],OreAlgebra[S[n],S[i],S[j]]]],S[j]-1]

(* We have to address the denominator j-n-1 in the certificate (skipped here). *)
(* Which values have to be checked such that it follows that the sum is zero for all 1<i<n *)
AnnihilatorSingularities[annsum,{1,1},Assumptions->i<n]

Sum[a[i,j]*c[n,j],{j,1,n}]/.(First/@%)

%/.{a[i_,j_]->1/(2i+2j-1),c[n_,j_]:>cc[[n,j]]}

(* Derive a recurrence for sum_{j=1}^n a_{n,j}*c_{n,j}, either by closure properties... *)
{rec}=DFiniteSubstitute[annsum,{i->n}]

(* ...or by creative telescoping again: *)
CreativeTelescoping[DFiniteTimes[Annihilator[1/(2n+2j-1),{S[n],S[j]}],annc],S[j]-1]

(* This gives a closed form for the quotient f[n] = det_n / det_{n-1} *)
RSolve[{ApplyOreOperator[rec,f[n]]==0,f[1]==1/3},f[n],n]

quo=FullSimplify[%[[1,1,2]]]/.n->i

(* After some by-hand rewriting, we find the closed form h0[n] given in the paper. *)
h0[n_]:=Product[((i-1)!)^2/Pochhammer[i+1/2,n],{i,1,n}]/2^n;

(* Check *)
Table[Product[quo,{i,1,n}]/h0[n],{n,10}]

4. Upper and Lower Bounds

Lemma 4.2

(* Summand in the definition of F_n *)
smnd=(-4)^(j-nu)*Pochhammer[2nu-2j+1,n]/(2j-2nu+n)!*λ^j;

Case n=2k+2:

g[j_]:=4^(j-k)*Pochhammer[2k+3-2j,2k+2]/(2j+1)!*(k-j+1);
FullSimplify[(((smnd/.n->2k+3)-(smnd/.n->2k+2))/.{nu->k+1,λ->x})/((-1)^(k-j+1)*g[j]*x^j)]

ineq=Simplify[{f1/2*g[j],g[j-1]}]

ineq=FunctionExpand[ineq/4^(j-k-1)*(2j+1)!/Pochhammer[2k-2j+5,2k]]/.f1->Pochhammer[2k+1,4]/8

Collect[ineq[[1]]-ineq[[2]]/.j->k-j,k,Expand]

Expand[%/.k->j]

CylindricalDecomposition[Implies[1≤j≤k,Greater@@ineq],{j,k}]

Case n=2k+1:

g[j_]:=4^(j-k)*Pochhammer[2k+3-2j,2k+1]/(2j)!*(k-j+1);
(* Test *)
Simplify[FunctionExpand[(((smnd/.{n->2k+2,nu->k+1})-(λ*smnd/.{n->2k+1,j->j-1,nu->k}))/.λ->x)/((-1)^(k-j+1)*g[j]*x^j)]]

ineq=FunctionExpand[f1/2*g[j]/g[j-1]/.f1->Pochhammer[2k,4]/8]

CylindricalDecomposition[Implies[1≤j≤k,ineq>1],{j,k}]

Collect[Numerator[ineq]-Denominator[ineq]/.j->k-j,k,Expand]

Expand[%/.k->j]

%%/.j->0

Lemma 4.3

ineq=FunctionExpand[f[1]/2*f[j]/f[j+1]/.f[j_]->Pochhammer[n-2j+1,4j]/4^j/(2j)!]

CylindricalDecomposition[Implies[1≤j≤n/2-1,ineq>1],{j,n}]

Collect[Numerator[ineq]-Denominator[ineq],n,Factor]

Expand[%/.n->2j+2]

Lemma 4.8

poly3=Sum[(-1)^j*Pochhammer[n-2j+1,4j]/4^j/(2j)!*x^(3-j),{j,0,3}]

Table[FullSimplify[poly3/.x->f1*(1/3+(r1+Sqrt[r2])^(1/3)+(r1-Sqrt[r2])^(1/3))/.{f1->Pochhammer[n-1,4]/8,r1->(2(n^8+4n^7+8n^6+10n^5+404n^4+796n^3-4733n^2-5130n+16200))/(135n^2(n-1)^2(n+1)^2(n+2)^2),r2->((n-2)(n-3)(n+4)(n+3)qn)/(145800n^4(n-1)^4(n+1)^4(n+2)^4)}/.qn->7n^12+42n^11-641n^10-3590n^9-2951n^8+10198n^7-20619n^6-113090n^5+4705644n^4+9619080n^3-40140000n^2-44971200n+116640000/.n->nn],{nn,2,10}]

pp1=(16200-5130*n-4733*n^2+796*n^3+404*n^4+10*n^5+8*n^6+4*n^7+n^8)/4320;
pp2=(-3+n)*(-2+n)*(3+n)*(4+n)*(116640000-44971200*n-40140000*n^2+9619080*n^3+4705644*n^4-113090*n^5-20619*n^6+10198*n^7-2951*n^8-3590*n^9-641*n^10+42*n^11+7*n^12)/597196800;
Table[FullSimplify[poly3/.x->f1/3+(f1*(p1+Sqrt[p2]))^(1/3)+(f1*(p1-Sqrt[p2]))^(1/3)/.{f1->Pochhammer[n-1,4]/8,p1->pp1,p2->pp2}/.n->nn],{nn,10}]

(* p1 = -Q/(2*f1) *)
Expand[-(2b^3/27-b c/3+d)/(2*f[1])/.{b->-f[1],c->f[2],d->-f[3]}]
Together[%/pp1/.f[j_]->Pochhammer[n-2j+1,4j]/4^j/(2j)!]

(* p2 = Delta/f1^2 *)
With[{Delta=((3c-b^2)/9)^3+(Q/2)^2},
Expand[Delta/f[1]^2/.Q->2b^3/27-b c/3+d]/.{b->-f[1],c->f[2],d->-f[3]}]
Together[%/pp2/.f[j_]->Pochhammer[n-2j+1,4j]/4^j/(2j)!]

(* Derive the formula for M(n) using Mathematica's Solve. *)
First[x/.Solve[poly3==0,x]]

Simplify/@(%/.
a_/;PolynomialQ[a,n]:>Factor[a]/.
(597196800pp2)->597196800p2/.
Expand[27/4*Pochhammer[n-1,4]*pp1]->54f1*p1//.
Pochhammer[n-1,4]->8f1)

%/.(f1*(p1+Sqrt[p2]))^(-1/3):>f1^(-2/3)*PowerExpand[(Factor[pp1^2-pp2]/.Pochhammer[n-1,4]->8f1)^(-1/3)]*(f1*(p1-Sqrt[p2]))^(1/3)

5. Asymptotic Behaviour of the Roots

Plots

data=Table[Flatten[Table[{n,λ}/.Solve[ff[n]==0,λ],{n,i,50,2}],1],{i,2,3}];
f12=Table[{n,Pochhammer[n-1,4]/16},{n,50}];
ListLogPlot[Append[data,f12],PlotStyle->{Blue,Red,Green},ImageSize->600]
myplot=ListLogPlot[data,PlotMarkers->{"×","\[Square]"},PlotStyle->Black,ImageSize->600]
(*Export["roots.jpg",myplot,"CompressionLevel"->0.01];*)

Proposition 5.1

(* even case *)
Sort[N[λ/.Solve[ff[100]==0,λ]]]/Table[((k-1/2)Pi)^2,{k,50}]

(* odd case *)
Sort[N[λ/.Solve[ff[101]==0,λ]]]/Table[(k Pi)^2,{k,50}]

Proposition 5.2

Table[Together[((λ^Floor[n/2]*(ff[n]/.λ->1/λ))/.λ->λ/n^4)/Sum[Pochhammer[2j+1,n]/(-4n^4)^j/(n-2j)!*λ^j,{j,0,Floor[n/2]}]],{n,20}]

Limit[Pochhammer[2j+1,n]/(-4n^4)^j/(n-2j)!,n->Infinity]

Table[Max[Re[N[λ/.Solve[ff[n]==0,λ]]]]/n^4/(1/Pi^2),{n,2,100}]

6. The Boundary Estimate

bb[i_,j_]:=1+(-1)^(i+j)-If[i===j,2x/(2i+1),0];

Table[Factor[det[bb,n]],{n,20}]

%/Table[(-2)^n*x^(n-2)*(x-If[EvenQ[n],n^2+n,n^2+3n+2]/2)*(x-If[EvenQ[n],n^2+3n,n^2+n-2]/2)/(2n+1)!!,{n,20}]

b0[i_,j_]:=2-If[i===j,2x/(4i+1),0];
b1[i_,j_]:=2-If[i===j,2x/(4i-1),0];
Table[Together[det[bb,n]/(det[b0,Floor[n/2]]*det[b1,Ceiling[n/2]])],{n,2,20}]

MatrixForm[m5=mat[b0,5]]

Do[m5[[i]]=m5[[i]]-m5[[1]],{i,2,5}]
MatrixForm[m5]

Do[m5[[1]]=m5[[1]]-2*m5[[i]]/m5[[i,i]],{i,2,5}]
MatrixForm[m5]

Table[Together[det[b0,n]/((-1)^n/2^n/Pochhammer[5/4,n]*x^(n-1)*(x-2n^2-3n))],{n,10}]
Table[Together[det[b1,n]/((-1)^n/2^n/Pochhammer[3/4,n]*x^(n-1)*(x-2n^2-n))],{n,10}]

Table[Together[det[bb,n]/((-1)^n/Pochhammer[3/2,n]*x^(n-2)*(x-2Floor[n/2]^2-3Floor[n/2])*(x-2Ceiling[n/2]^2-Ceiling[n/2]))],{n,10}]