read Cheyne: read AlgFunEq: read oCheyne2: print(`Explicit Expressions, in n, for the First Two Moments of the r.v. Number of occurrences of the pattern 213`): print(`in the set of 123-permutations of length n, and a linear recurrence for the the third moment`): print(``): print(`By Shalosh B. Ekhad `): print(``): gu:=CH35: gu:=t*diff(gu,t): print(``): print(`An explicit expression for the expectation (times C(n)), in other total number of occurrences of the pattern 213 in AV(123) is`): print(`where C(n) denotes the Catalan number C(n)=(2*n)!/(n!*(n+1)! is: `): print(``): ka:=NakhesC(subs(t=1,gu),n,C): print(ka): print(`and in Maple-input format`): print(``): lprint(ka): print(``): print(`This reproduces, in a somewhat nicer form, the expression for b_n given in Cor. 24 of Cheyne Homberger's article`): print(` ElJC 19(3) (2012), #P43 `): gu:=t*diff(gu,t): print(``): print(`An explicit expression (very possibly beyond the scope of mere humans) `): print(` for the second moment (times C(n)), i.e. the sum of (#occurrences of the pattern 213(pi))^2 over pi in Av_n(123) `): print(`where C(n) denotes the Catalan number C(n)=(2*n)!/(n!*(n+1)! is: `): print(``): ka:=NakhesC(subs(t=1,gu),n,C): print(ka): print(`and in Maple-input format`): print(``): lprint(ka): gu:=t*diff(gu,t): print(``): print(`We could not find an explicit expression for the third moment (times C(n)), i.e. the sum of (#occurrences of the pattern 213(pi))^3 over pi in Av_n(123) `): print(`but we found the next best thing, a linear recurrence equation with polynomial coefficients`): print(`We bet that no human would ever be able to find it!`): print(``): print(`Calling this sequence M3(n) `): print(``): gu:=subs(t=1,gu): gu:=[op(2..nops(gu),gu)]: ope:=Findrec(gu,n,N,10): print(ope): print(``): print(add(factor(coeff(ope,N,i))*M3(n+i),i=0..degree(ope,N))=0): print(`and in Maple-input format`): print(``): lprint(add(factor(coeff(ope,N,i))*M3(n+i),i=0..degree(ope,N))=0): print(`This ends this article, that took`, time(), `seconds. but relying on pre-computed data that took much longer `): quit: