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