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