Advertisement
a53

FactoriPrimi1

a53
Jan 8th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #define ULL unsigned long long int
  3. using namespace std;
  4.  
  5. ULL minDivPrim(ULL n)
  6. {
  7. ULL p=1;
  8. for(ULL d=2;d*d<=n;++d)
  9. {
  10. if(n%d==0)
  11. {
  12. while(n%d==0)
  13. n=n/d;
  14. p*=d;
  15. }
  16. }
  17. if(n>1)
  18. p*=n;
  19. if(p==1)
  20. return n;
  21. return p;
  22. }
  23.  
  24. int main()
  25. {
  26. ULL n;
  27. cin>>n;
  28. cout<<minDivPrim(n);
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement