I want to create a table of random numbers and their divisors. The random numbers are given by
TableForm[{{Subscript[m, 1] = RandomInteger[{2, 50}],
Subscript[n, 1] = RandomInteger[{2, 50}]},
{Subscript[m, 2] = RandomInteger[{2, 50}],
Subscript[n, 2] = RandomInteger[{2, 50}]},
{Subscript[m, 3] = RandomInteger[{2, 50}],
Subscript[n, 3] = RandomInteger[{2, 50}]}},
TableHeadings -> {{"1", "2", "3"}, {"m", "n"}},
TableAlignments -> Center]
So far so good. A neat table with delimiters for the headings. But when I try to add the divisors it all goes wrong:
TableForm[{{Subscript[m, 1] = RandomInteger[{2, 50}],
Subscript[n, 1] = RandomInteger[{2, 50}],
Divisors[Subscript[m, 1]],
Divisors[Subscript[n, 1]]}, {Subscript[m, 2] =
RandomInteger[{2, 50}],
Subscript[n, 2] = RandomInteger[{2, 50}],
Divisors[Subscript[m, 2]], Divisors[Subscript[n, 2]]},
{Subscript[m, 3] = RandomInteger[{2, 50}],
Subscript[n, 3] = RandomInteger[{2, 50}],
Divisors[Subscript[m, 3]], Divisors[Subscript[n, 3]]}},
TableHeadings -> {{"1", "2", "3"}, {"m", "n", "divisors[m]",
"divisors[n]"}},
TableAlignments -> Center]
I want the heading delimiters to remain, but they disappear; and I'd like the divisors to appear in a comma-delimited horizontal list (for example Divisors[4]
would produce 1,2,4
rather than a vertical list.