Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int putere(int n){
- int p,d=2,pmin=1000000,sol=0;
- while (n!=1)
- {
- p=0;
- while (n%d==0)
- {
- n=n/d;
- p++;
- //construim d ^ p
- }
- if(p!=0 && p<pmin){
- pmin=p;
- sol=d;
- }
- d++;
- }
- return sol;
- }
- int main()
- {
- int n;
- cin>> n;
- cout<<putere(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement