[seqfan] Re: Help needed with Mathematica program for square array with two linked recurrences.

Mats Granvik mgranvik at abo.fi
Sun Jul 10 10:45:59 CEST 2011


Olivier Gerard commented on the errors in my program. By translating the cell
formula directly, Mathematica can now handle it.

Clear[t, n, k, i, nn]
  t[n_, k_] :=
    t[n, k] =
     If[And[n == 1, k == 1], 1,
      If[Or[And[n == 1, k == 2], And[n == 2, k == 1]], 2,
       If[n == 1, (-t[n, k - 1] - Sum[t[i, k], {i, 2, k - 1}])/(k + 1)  
+ t[n, k - 1],
        If[k == 1, (-t[n - 1, k] - Sum[t[n, i], {i, 2, n - 1}])/(n +  
1) + t[n - 1, k],
         If[n >= k, -Sum[t[n - i, k], {i, 1, k - 1}], -Sum[t[k - i,  
n], {i, 1, n - 1}]]]]]];
  nn = 12;
  MatrixForm[Table[Table[t[n, k], {k, 1, nn}], {n, 1, nn}]]

Mats





More information about the SeqFan mailing list