local function factorize( n ) if n == 1 then return {1} end local k, res = 2, {} while n > 1 do while n % k == 0 do res[#res+1] = k n = n / k end k = k + 1 end return res end for i = 1, 22 do print( string.format( "%2d", i ) .. ": " .. table.concat( factorize( i ), " * " ) ) end