<<2motzkin.m

Computation of the generating function for Motzkin numbers modulo 4

M4

Computation of the generating function for Motzkin numbers modulo 16

M16

Program for the Motzkin numbers

M[n_]:=M[n]=((2n+1)M[n-1]+3(n-1)M[n-2])/(n+2);
M[0]=M[1]=1;

Table[M[n],{n,1,20}]

Computation of the generating function for Motzkin prefix numbers modulo 4

MP4

Computation of the generating function for Motzkin prefix numbers modulo 16

MP16

Program for the Motzkin prefix numbers

MP[n_]:=MP[n]=((2n+2)MP[n-1]+3(n-1)MP[n-2])/(n+1);
MP[0]=1;MP[1]=2;

Table[MP[n],{n,1,20}]

Computation of the generating function for Riordan numbers modulo 4

R4

Computation of the generating function for Riordan numbers modulo 16

R16

Program for the Riordan numbers

R[n_]:=R[n]=(n-1)*(2*R[n-1]+3*R[n-2])/(n+1);
R[0]=1;R[1]=0;

Table[R[n],{n,1,20}]

Computation of the generating function for hex tree numbers modulo 4

H4

Computation of the generating function for hex tree numbers modulo 16

H16

Program for the hex tree numbers

H[n_]:=H[n]=((6n+3)*H[n-1]-(5n-5)*H[n-2])/(n+2);
H[0]=1;H[1]=3;

Table[H[n],{n,1,20}]

Program for the central trinomial numbers

T[n_]:=T[n]=((2*n-1)*T[n-1]+3*(n-1)*T[n-2])/n;
T[0]=T[1]=1;

Table[T[n],{n,1,20}]

a(n)=(n-1)*(2*a(n-1)+3*a(n-2))/(n+1)