#include #include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = (int)n - 1; i > -1; i--) #define all(x) (x).begin(), (x).end() #define ll long long #define ld long double #define INF 1000000000000000000 typedef pair pll; ll N, K, M; set cnt; vector> prime_factorize(long long N) { vector> res; for (long long a = 2; a * a <= N; ++a) { if (N % a != 0) continue; long long ex = 0; // 指数 // 割れる限り割り続ける while (N % a == 0) { ++ex; N /= a; } // その結果を push res.push_back({a, ex}); } // 最後に残った数について if (N != 1) res.push_back({N, 1}); return res; } void dfs(int depth, ll tmp, vector pri) { cnt.insert(tmp); if (depth == pri.size()) return; rep(i, pri[depth].second + 1) { ll tmp2 = tmp * pow(pri[depth].first, i); if (tmp2 > M) break; else { dfs(depth + 1, tmp2, pri); } } } int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> N >> K >> M; vector pri = prime_factorize(N); rep(i, pri.size()) { pri[i].second *= K; } dfs(0, 1, pri); cout << cnt.size() << endl; }