#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace atcoder; typedef long long ll; typedef long double ld; typedef std::pair pii; typedef std::pair pll; typedef std::pair pid; typedef std::pair pls; typedef std::vector vb; typedef std::vector vvb; typedef std::vector vi; typedef std::vector vvi; typedef std::vector vvvi; typedef std::vector vvvvi; typedef std::vector vl; typedef std::vector vvl; typedef std::vector vvvl; typedef std::vector vvvvl; typedef std::vector vd; typedef std::vector vvd; typedef std::vector vs; #define rep(i,n) for(auto i=0; i=0; --i) #define repdm(i,e,n) for(auto i=n-1; i>=e; --i) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() template inline bool chmax(T& a, T b, int eq = 0) { if (a < b || (a == b && eq)) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b, int eq = 0) { if (a > b || (a == b && eq)) { a = b; return 1; } return 0; } template * = nullptr> constexpr istream& operator>>(istream& is, mint& x) noexcept {long long v = 0; std::cin >> v; x = v; return is;} template * = nullptr> constexpr ostream& operator<<(ostream& os, const mint& x) noexcept {os << x.val(); return os;} inline void _n() { std::cout << std::endl; } template inline void _(const T a) { std::cout << a; } template inline void _l(const T a) { _(a); _n(); } template inline void _s(const T a) { _(a); _(' '); } template inline void _v(const std::vector v) { for(auto a : v) _(a); } template inline void _vl(const std::vector v) { for(auto a : v) _l(a); } template inline void _vs(const std::vector v) { for(auto a : v) _s(a); _n(); } template inline void _vvl(const std::vector> v) { for(auto a : v) { _v(a); _n(); } } template inline void _vvs(const std::vector> v) { for(auto a : v) { _vs(a); } } inline void ynl(const bool b) {_l(b ? "yes" : "no");} inline void yns(const bool b) {_l(b ? "Yes" : "No");} inline void ynu(const bool b) {_l(b ? "YES" : "NO");} constexpr int INF = numeric_limits::max() >> 1; constexpr long long INF_LL = numeric_limits::max() >> 1LL; const long long MOD1 = 1000000007; const long long MOD9 = 998244353; using mint1 = atcoder::modint1000000007; using mint9 = atcoder::modint998244353; //* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *// void input() { } struct sieve_E { public : sieve_E(long long n) : _n(n) { size = (_n/spp + 1) * srl; sieve = vector(size, true); sieving_prime = vector(size, 0); sieving(); } bool is_prime(long long n) { assert(0 <= n && n <= _n); if (n == 0 || n == 1) return false; for (auto p : sp) {if(n == p) return true; if(n%p == 0) return false;} return sieve[ntoi(n)]; } unsigned long long get_sieving_prime(long long n) { assert(0 <= n && n <= _n); if (n == 0 || n == 1) return 0; for (auto p : sp) {if(n%p == 0) return p;} if (is_prime(n)) return n; return sieving_prime[ntoi(n)]; } unsigned long long get_sieve_size() {return _n;} private : long long _n; unsigned long long size; std::vector sieve; std::vector sieving_prime; const std::vector sp = {2, 3, 5}; // skip primes const std::vector sr = {1, 7, 11, 13, 17, 19, 23, 29}; // stand reminders const unsigned int spp = 2 * 3 * 5; // skip primes product const unsigned int srl = 8; // stand reminders length void sieving() { unsigned long long max_i = ((unsigned long long)sqrt(_n)/spp + 1) * srl; for (unsigned long long i = 1; i <= max_i ; ++i) { if(!sieve[i]) continue; unsigned long long num_i = (unsigned long long)iton(i); for (unsigned long long j = num_i * num_i; j < (unsigned long long)_n; j += num_i) { long long idx_j = ntoi(j); if(idx_j > 0) { sieve[idx_j] = false; sieving_prime[idx_j] = num_i; } } } } unsigned long long iton(unsigned long long idx) { return (unsigned long long) ((idx/srl) * spp + sr[idx%srl]); } long long ntoi(unsigned long long num) { unsigned int sri = (unsigned int)(std::find(sr.begin(), sr.end(), num%spp) - sr.begin()); return sri == srl ? -1 : (num/spp) * srl + sri; } }; void solve() { ll N, L; cin >> N >> L; sieve_E sieve(L); ll ans = 0; repm(d, 2, L+1) { if(!sieve.is_prime(d)) continue; if((N-1) * d > L) break; ans += L - d * (N-1) + 1; } _l(ans); } //* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *// int main() { std::ifstream in("input.txt"); std::cin.rdbuf(in.rdbuf()); std::cin.tie(0); std::ios::sync_with_stdio(false); input(); solve(); return 0; }