%I #11 Jan 08 2013 14:31:05
%S 1,2,3,4,2,2,5,6,2,3,7,8,2,4,2,2,2,9,3,3,10,2,5,11,12,2,6,3,4,2,2,3,
%T 13,14,2,7,15,3,5,16,2,8,4,4,2,2,4,2,2,2,2,17,18,2,9,3,6,2,3,3,19,20,
%U 2,10,4,5,2,2,5,21,3,7,22,2,11,23,24,2,12,3,8,4,6,2,2,6,2,3,4,2,2,2,3,25,5,5
%N Irregular triangle in which row n lists all factorizations of n, sorted by the number of factors in each factorization.
%C Row n begins with n because it is a factorization of length 1. In each factorization, the factors are in nondecreasing order. This sequence is A056472 with the factorizations in a different order. Sequence A001055(n) gives the number of factorizations of n; A066637(n) gives the number of numbers in row n. In the Mathematica program, the function f returns a list of the factorizations of n.
%C These factorizations are useful in determining the forms of numbers that have a given number of divisors. For example, to find the forms of numbers that have 12 divisors, we look at the four factorizations of 12 (12, 2*6, 3*4, 2*2*3), subtract 1 from each factor, and find the forms to be p^11, p q^5, p^2 q^3, and p q r^2, where p, q, and r are prime numbers.
%D See A001055.
%H T. D. Noe, <a href="/A162247/b162247.txt">Rows n=1..1000 of triangle, flattened</a>
%H R. J. Mathar, <a href="/A162247/a162247.txt">Factorizations of n=1..1100</a>
%e 1;
%e 2;
%e 3;
%e 4,2*2;
%e 5;
%e 6,2*3;
%e 7;
%e 8,2*4,2*2*2;
%e 9,3*3;
%e 10,2*5;
%e 11;
%e 12,2*6,3*4,2*2*3;
%t g[lst_,p_] := Module[{t,i,j}, Union[Flatten[Table[t=lst[[i]]; t[[j]]=p*t[[j]]; Sort[t], {i,Length[lst]}, {j,Length[lst[[i]]]}], 1], Table[Sort[Append[lst[[i]],p]], {i,Length[lst]}]]]; f[n_] := Module[{i,j,p,e,lst={{}}}, {p,e}=Transpose[FactorInteger[n]]; Do[lst=g[lst,p[[i]]], {i,Length[p]}, {j,e[[i]]}]; lst]; Flatten[Table[f[n], {n,25}]]
%o (Haskell)
%o import Data.List (sortBy)
%o import Data.Ord (comparing)
%o a162247 n k = a162247_tabl !! (n-1) !! (k-1)
%o a162247_row n = a162247_tabl !! (n-1)
%o a162247_tabl = map (concat . sortBy (comparing length)) $ tail fss where
%o fss = [] : map fact [1..] where
%o fact x = [x] : [d : fs | d <- [2..x], let (x',r) = divMod x d,
%o r == 0, fs <- fss !! x', d <= head fs]
%o -- _Reinhard Zumkeller_, Jan 08 2013
%K nice,tabf,nonn
%O 1,2
%A _T. D. Noe_, Jun 28 2009