输入一个正整数n(2<=n<=108),请将n用质因数乘式的形式表示,如果质因数不止一个,请按照质因数大小升序输出,每个数字后面均有空格。
ar
i,n,plen:longint;
prime:array[1..5000] of longint;
procedure Gen_Prime;
var
h:array[1..10000] of boolean;
i,j:longint;
begin
fillchar(h,sizeof(h),false);
for i:=2 to 10000 do
if not h[i] then
begin
j:=2;
while i*j<=10000 do
begin
if h[i*j]=false then
h[i*j]:=true ;
j:=j+1;
end;
end;
plen:=0;
for i:=2 to 10000 do
if not h[i] then
begin
plen:=plen+1;
prime[plen]:=i ;
end;
end;
begin
read(n);
Gen_Prime;
for i:=1 to plen do
while n mod prime[i]=0 do
begin
write(prime[i],' ');
n:=n div prime[i] ;
end;
if n>1 then write(n,' ');
writeln;
end.