/* _ooOoo_ o8888888o 88" . "88 (| -_- |) O\ = /O ____/`---'\____ .' \\| |// `. / \\||| : |||// \ / _||||| -:- |||||- \ | | \\\ - /// | | | \_| ''\---/'' | | \ .-\__ `-` ___/-. / ___`. .' /--.--\ `. . __ ."" '< `.___\_<|>_/___.' >'"". | | : `- \`.;`\ _ /`;.`/ - ` : | | \ \ `-. \_ __\ /__ _/ .-` / / ======`-.____`-.___\_____/___.-`____.-'====== `=---=' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pass System Test! */ #include using namespace std; template std::ostream &operator<<(std::ostream &out, const std::vector &v) { if (!v.empty()) { out << '['; std::copy(v.begin(), v.end(), std::ostream_iterator(out, ", ")); out << "\b\b]"; } return out; } template std::ostream &operator<<(std::ostream &out, const std::pair &p) { out << "[" << p.first << ", " << p.second << "]"; return out; } template void chmin(T &t, U f) { if (t > f) t = f; } template void chmax(T &t, U f) { if (t < f) t = f; } template void uniq(vector &v) { v.erase(unique(v.begin(), v.end()), v.end()); } vector eratosthenes(int N) { vector is_prime(N + 1, true); vector primes; is_prime[0] = false; is_prime[1] = false; for (int i = 2; i <= N; ++i) if (is_prime[i]) { primes.push_back(i); for (int j = i * 2; j <= N; j += i) { is_prime[j] = false; } } return primes; } int64_t L, H; vector primes; int64_t dfs_check(int64_t d, int pos) { if (L <= d && d <= H) return d; int64_t ans = -1; for (int i = pos; i < primes.size(); ++i) { if (d * primes[i] > H) break; chmax(ans, dfs_check(d * primes[i], i)); } return ans; } int main() { cin.tie(0); ios::sync_with_stdio(false); primes = eratosthenes(1e6); cin >> L >> H; int64_t ans = 0; for (int i = 0; i < primes.size(); ++i) { int64_t d = dfs_check(primes[i], i); if (d > primes[i]) ans = d; } assert(ans > 0); cout << ans << endl; }