1

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.

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
Tyler Durden
  • 4,090
  • 14
  • 43

1 Answers1

3

For simply transposing a ragged array, see Transpose uneven lists

For displaying various transpositions both as upper or lower triangular formats, pad the array before display:

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

enter image description here

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
  • I tried Flatten[Tally[IntegerPartitions[#][[All, 1]]][[All, 2]] & /@ Range[20] // Reverse, {2}] // TableForm and it almost worked (columns were reverse ordered). Is Ragged/Transpose better than Flatten? – Tyler Durden Dec 07 '13 at 00:37