# How can I format 256 items into a column of four grids of 16 rows and 8 columns?

ab = DisplayForm[
GridBox[Flatten /@
Transpose@
Partition[
Table[{n,
FactorInteger[n] /. List[p_Integer, 0] :> HoldForm[p] /.
List[p_Integer, k_Integer] :> HoldForm[p^k] /.
List[x__] :> Times@x /. {} -> 1}, {n, 1, 256}], 16],
GridFrame -> True, RowLines -> True, ColumnLines -> True]]


result image

result that I hope

How to I divide 256 by pieces of four of horizontal 4 * vertical 16?

• mathworld.wolfram.com/notebooks/PrimeNumbers/… Jan 18, 2015 at 23:09
• You edited your desired result to look different than it did. You want to print a series of "tables" down the page? Jan 18, 2015 at 23:32
• Yes. I wish result of i.sstatic.net/qhRGq.png Jan 18, 2015 at 23:34
• Okay. People on this site answer questions voluntarily on their own time, therefore you should be patient. I shall revise my answer when I get around to it. Jan 19, 2015 at 0:29

Here is a modularized method. The first function is from Trying to write out the prime factorization of a number with CenterDot and Superscript, slightly modified.

Format[primeFactorForm[n_Integer]] :=
Times @@ Superscript @@@ FactorInteger[n] /. _[x_] :> x

block[n_Integer] :=
Join @@@ Array[{#, primeFactorForm@#} &[# + 16*#2] &, {16, 4}, {64 n - 63, 0}]

grid[m_?MatrixQ] :=
With[{th = AbsoluteThickness[3]}, Grid[m, Dividers -> ({#, #} &@{th, {True}, th})]]

Array[grid @ block @ # &, 4] // Column


## Old answer for original example

There is probably a cleaner way to write this but here's a start for you:

tab = Table[{n,
FactorInteger[n] /. List[p_Integer, 0] :> HoldForm[p] /.
List[p_Integer, k_Integer] :> HoldForm[p^k] /. List[x__] :> Times@x /. {} ->
1}, {n, 1, 256}];

eight   = Prepend[Table[True, {7}], AbsoluteThickness[3]];

sixteen = Prepend[Table[True, {15}], AbsoluteThickness[3]];

Grid[Flatten /@ Transpose@Partition[tab, 16], Dividers -> {{eight}, {sixteen}},
ItemSize -> Full]

• This looks really fun! Jan 19, 2015 at 0:57
• @ChenStatsYu :-P Jan 19, 2015 at 1:42