Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1.  
  2. void putere(int n, int &d, int &p)
  3. {
  4. d = 2;
  5. int dmaxi = 0,pmaxi = 0, nr, aux;
  6. while(d * d <= n){
  7. p = 0, nr = 1;
  8. if(n % d == 0){
  9. while(n % d == 0){
  10. p++;
  11. n /= d;
  12. }
  13. aux = p;
  14. while(aux){
  15. nr *= d;
  16. aux--;
  17. }
  18.  
  19. if(dmaxi <= nr){
  20. dmaxi = d;
  21. pmaxi = p;
  22. }
  23.  
  24. }
  25.  
  26. d++;
  27. }
  28. d = dmaxi;
  29. p = pmaxi;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement