[seqfan] Re: Mathematica code for A050446.

Richard Mathar mathar at strw.leidenuniv.nl
Wed Dec 14 12:29:37 CET 2011


http://list.seqfan.eu/pipermail/seqfan/2011-December/016078.html

> From seqfan-bounces at list.seqfan.eu Wed Dec 14 11:14:52 2011
> Date: Tue, 13 Dec 2011 21:42:55 -0800 (PST)
> From: Ed Jeffery 
> To: "seqfan at list.seqfan.eu" <seqfan at list.seqfan.eu>
> Subject: [seqfan] Mathematica code for A050446.
> 
> Could someone please verify the Mathematica code for A050446 (https://oeis.org/A050446) and let me know if it correctly generates the table given in the example there? I can't get the right table using Mathcad even single-stepping through the calculations according to that code. The Mathematica code is:
> 
> t[n_, m_?Positive] := t[n, m] = t[n, m-1] + Sum[t[2k, m-1]*t[n-1 - 
> 2k, m], {k, 0, (n-1)/2}]; t[n_, 0] = 1; Table[t[i-k , k-1], {i, 1, 12}, 
> {k, 1, i}] // Flatten
> 
> I think the second part of the code, Table[t[etc.]], which I can't do in Mathcad, just reads the array t[n,m] by anti-diagonals transforming the array into a table, although I have no experience with Mathematica. I also assumed that the implied range for k in the summation is {k, 0, floor((n-1)/2)}, since in the summation using Mathcad I have to have (n-1)/2 a positive integer. Maybe someone could take a minute to give me a detailed description of what that code actually does, since evidently I have misunderstood it somehow.
> 

The Mma code seems to be a rewriting of the formula. The formula is 
correct and can be also worked out in Maple (which I did): start the column
m=0 with all-1, and use recursively a summation over k=0 up to floor((n-1)/2).
The bad thing of the Mma code is that it uses a second index summation
starting at 1, where 0 would be the natural choice because rows and columns
are indexed from 0 upwards.
In the maple code I use the variable "d" (for diagonal, 0 increasing) and then a
column index m=0 up to d, and a row index n=d-m.

RJM



More information about the SeqFan mailing list