#include #include #include #include #include #include #include #include #include #include #include #include #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; vector enumarate_facs(ll n){ vector ans; for(int i = 1; i*i <= n; i++){ if(n%i == 0){ ans.push_back(i); if(i*i != n) ans.push_back(n/i); } } sort(ans.begin(), ans.end()); return ans; } ll n, x; int ans; void dfs(int i, int j, int k, vector &facs, vector> &inv){ int m = facs.size(); // cout << "dfs(" << i << "," << facs[j] << "," << facs[k] << ")" << endl; double rem = (double)x/(double)facs[k]; bool too_large = [&]() -> bool{ double t = 0.5*facs[k]; for(int l = i; l < n; l++){ t *= facs[j]; if(t > x) return true; } return false; }(); if(too_large) { return; } if(i == n){ if(k == m-1) ans++; return; } for(int l = max(j, 1); l < m; l++){ if(inv[k][l] == -1) continue; dfs(i+1, l, inv[k][l], facs, inv); } } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; cin >> n >> x; if(n > 30){ cout << 0 << endl; return 0; } x++; auto facs = enumarate_facs(x); int m = facs.size(); vector> inv(m, vector(m, -1)); map mp = [&](){ map ans; for(int i = 0; i < m; i++) ans[facs[i]] = i; return ans; }(); for(int i = 0; i < m; i++){ for(int j = 0; j < m; j++){ ll p = facs[i]*facs[j]; if(p > x) continue; if(x%p == 0){ // cout << facs[i] << '*' << facs[j] << '=' << facs[mp[p]] << endl; inv[i][j] = mp[p]; } } } dfs(0, 0, 0, facs, inv); cout << ans << endl; }