STANAANDREY

bacT7 sIII 1

May 25th, 2021 (edited)
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int putere(int n, int p) {
  5.     if ((p != 2 && p % 2 == 0) || p == 1) {
  6.         return -1;
  7.     }
  8.     for (int i = 3; i * i <= n; i += 2) {
  9.         if (p % i == 0) {
  10.             return -1;
  11.         }
  12.     }
  13.     int nr = 0;
  14.     while (n % p == 0) {
  15.         nr++;
  16.         n /= p;
  17.     }
  18.     return nr;
  19. }
  20.  
  21. int main() {
  22.     //call here
  23.     return 0;
  24. }
  25.  
Add Comment
Please, Sign In to add comment