# PARI to Mathematica conversion

I need to use the coefficients T(n,k) in my algorithm and I found a program in PARI

Can anybody translate this code to mathematica?

{T (n, k) =
if (n == 0, 1,
if (k == 0, 1,
if (k == n, 3^n*(3^n - sum (j = 0, n - 1, T (n, j)/3^j)),
polcoeff ((Ser (vector (n, i, T (n - 1, i - 1)), x) +
x*O (x^k))^((n + 1)/n), k, x))))}

• If you are planning on using Mathematica a lot, then this is a great exercise to do yourself. I really think it's worth sitting down and trying to figure this out on your own. Apr 5 '17 at 22:44
• i tried, but I have some problems with Ser,vector part... Apr 5 '17 at 22:46
• Well, I can't help you with that, because I don't know PARI syntax. Perhaps you should edit your post to include what you have so far, and someone might be able to help. Apr 5 '17 at 22:51
• Probably better off to start from the math; that is, where did you get this code from? Can you describe what you're trying to compute here? Apr 5 '17 at 22:54
• Try this: Table[SeriesCoefficient[3 y/((1 - 9 x y) + (3 y - 1)*(1 - 9 x y)^(2/3)), {x, 0, j}, {y, 0, k}], {j, 0, 8}, {k, 0, j}]. (I used the generating function given there.) Apr 5 '17 at 23:08