#include #include #include #include #include // テストケース検証用の定数 constexpr int MIN_N = 3; constexpr int MAX_N = 1000000; constexpr int MIN_L = 1; constexpr int MAX_L = 20000000; // Eratosthenesの篩により、素数表をつくる std::vector sieve_of_eratosthenes(int end) { assert(end > 1); std::vector is_prime(end, true); is_prime[0] = false; is_prime[1] = false; std::vector primes; for (int i = 2; i < end; i++) { if (is_prime[i]) { primes.push_back(i); for (int j = 2 * i; j < end; j += i) { is_prime[j] = false; } } } return primes; } long long count_seqs(int n, int l) { auto x_max = [&](int d) {return l - (n - 1) * d; }; auto d_max = l / (n - 1); if (d_max < 2) { return 0; } auto ds = sieve_of_eratosthenes(d_max + 1); long long ans = 0; for (const auto& d : ds) { ans += x_max(d) + 1; } return ans; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int n, l; std::cin >> n >> l; assert(MIN_N <= n and n <= MAX_N); assert(MIN_L <= l and l <= MAX_L); std::cout << count_seqs(n, l) << std::endl; return EXIT_SUCCESS; }