24 lines
392 B
Text
24 lines
392 B
Text
factorNum := proc(n)
|
|
local i, j, firstNum;
|
|
if n = 1 then
|
|
printf("%a", 1);
|
|
end if;
|
|
firstNum := true:
|
|
for i in ifactors(n)[2] do
|
|
for j to i[2] do
|
|
if firstNum then
|
|
printf ("%a", i[1]);
|
|
firstNum := false:
|
|
else
|
|
printf(" x %a", i[1]);
|
|
end if;
|
|
end do;
|
|
end do;
|
|
printf("\n");
|
|
return NULL;
|
|
end proc:
|
|
|
|
for i from 1 to 10 do
|
|
printf("%2a: ", i);
|
|
factorNum(i);
|
|
end do;
|