top of page
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int n,f,p=0;
cin>>n;
f=2;
while(n%f==0)
{
n=n/f;
p++;
}
if(p>0)
cout<<f<<" "<<p<<"\n";
ifstream descompunere("descompunere in factori primi.in");
ofstream g("descompunere in factori primi.txt");
descompunere>>n;
g<<f<<" "<<p<<"\n";
f=3;
while(n>1)
{
p=0;
while(n%f==0)
{
n=n/f;
p++;
}
if(p>0)
cout<<f<<" "<<p<<"\n";
g<<f<<" "<<p<<"\n";
f=f+2;
}
return 0;
}
bottom of page