func_code_string: #include <bits/stdc++.h>   using namespace std;   long long ans;   long long cnt(long long i, long long n, long long count) {     long long c = 0, j = i, k = n;     while (k / i > 0) {       c += k / i;       k /= i;     }     c /= count;     return c;   }   void factorize(long long n, long long p) {     long long count = 0;     while (!(n % 2)) {       n >>= 1;       count++;     }     if (count) {       ans = min(ans, cnt(2, p, count));     }     long long y = n;     for (long long int i = 3; i * i <= y; i++) {       count = 0;       while (n % i == 0) {         count++;         n = n / i;       }       if (count) {         ans = min(ans, cnt(i, p, count));       }     }     if (n > 2) {       ans = min(ans, cnt(n, p, 1));     }     return;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     cout.tie(NULL);     long long n, b;     cin >> n >> b;     ans = LLONG_MAX;     factorize(b, n);     if (ans != LLONG_MAX)       cout << ans << endl;     else       cout << 0 << endl;   }   