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