# Transpose a ragged triangular matrix and display as columns rather than rows

I have a triangular list of lists as follows:

In[54]:= Tally[IntegerPartitions[#][[All,1]]][[All,2]]&/@Range[20]
Out[54]= {{1},{1,1},{1,1,1},{1,1,2,1},{1,1,2,2,1},{1,1,2,3,3,1},{1,1,2,3,4,3,1},{1,1,2,3,5,5,4,1},{1,1,2,3,5,6,7,4,1},{1,1,2,3,5,7,9,8,5,1},{1,1,2,3,5,7,10,11,10,5,1},{1,1,2,3,5,7,11,13,15,12,6,1},{1,1,2,3,5,7,11,14,18,18,14,6,1},{1,1,2,3,5,7,11,15,20,23,23,16,7,1},{1,1,2,3,5,7,11,15,21,26,30,27,19,7,1},{1,1,2,3,5,7,11,15,22,28,35,37,34,21,8,1},{1,1,2,3,5,7,11,15,22,29,38,44,47,39,24,8,1},{1,1,2,3,5,7,11,15,22,30,40,49,58,57,47,27,9,1},{1,1,2,3,5,7,11,15,22,30,41,52,65,71,70,54,30,9,1},{1,1,2,3,5,7,11,15,22,30,42,54,70,82,90,84,64,33,10,1}}


I want to display each member of the list in a column (ideally with # as the column heading). I tried using Column, Transpose and Inverse to no avail.

• With the output of the Tally called q, does TableForm[q] do what you wish? – bill s Dec 7 '13 at 0:12
• Is this what you're looking for, provided the ragged array is named ragged? Table[ragged[[i ;;, i]], {i, 1, Length@Last@ragged}] – Szabolcs Dec 7 '13 at 0:16
• It may be a duplicate of this – Szabolcs Dec 7 '13 at 0:24
• TableForm results in each sublist being presented in a row, not a column. – Tyler Durden Dec 7 '13 at 0:24

Transpose@PadRight[ragged, {Length[ragged], Length@Last[ragged]}, ""] // TableForm