#include //#include using namespace std; // using namespace atcoder; // using mint = modint1000000007; // const int mod = 1000000007; // using mint = modint998244353; // const int mod = 998244353; // const int INF = 1e9; // const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i, l, r) for (int i = (l); i < (r); ++i) #define rrep(i, n) for (int i = (n)-1; i >= 0; --i) #define rrep2(i, l, r) for (int i = (r)-1; i >= (l); --i) #define all(x) (x).begin(), (x).end() #define allR(x) (x).rbegin(), (x).rend() #define P pair template inline bool chmax(A& a, const B& b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A& a, const B& b) { if (a > b) { a = b; return true; } return false; } #ifndef KWM_T_BASE_INTEGR_HPP #define KWM_T_BASE_INTEGR_HPP #include /** * @brief ローカル環境用(MSC)int128 */ #ifdef _MSC_VER using int128 = long long; #else using int128 = __int128; #endif #endif // KWM_T_BASE_INTEGR_HPP #ifndef KWM_T_MATH_IS_PRIME_HPP #define KWM_T_MATH_IS_PRIME_HPP #include #include //#include "base/integer.hpp" namespace kwm_t::math { namespace detail { /** * @brief a^e mod m を計算する。 * * 計算量: * O(log e) * * @param a 底。 * @param e 指数。 * @param m 法。 * * 制約 / 注意: * - m > 0 を仮定する。 * - __int128 をサポートするコンパイラが必要。 */ inline long long mod_pow(int128 a, long long e, long long m) { int128 ret = 1; while (e > 0) { if (e & 1) { ret = ret * a % m; } a = a * a % m; e >>= 1; } return static_cast(ret); } } // namespace detail /** * @brief Miller-Rabin 法により n が素数か判定する。 * * 計算量: * O(log n) * * 制約 / 注意: * - n >= 0 を仮定する。 * - Miller-Rabin 法による素数判定。 * - 一般の n に対しては確率的アルゴリズムだが、 * 基底 {2, 3, 5, 7, 11} を用いる本実装では、 * n <= 10^12 の範囲において誤りなく素数判定を行える。 * 基底 {2, 325, 9375, 28178, 450775, 9780504, 1795265022} を用いる本実装では、 * n < 2^64 の範囲において誤りなく素数判定を行える。 * - __int128 をサポートするコンパイラが必要。 * * 使用例: * bool p1 = is_prime(2); // true * bool p2 = is_prime(1000000007); // true * bool p3 = is_prime(1000000008); // false * * verified: * - */ inline bool is_prime(long long n) { if (n <= 2) return n == 2; if (n % 2 == 0) return false; const std::vector a_list = { 2, 3, 5, 7, 11 }; // const std::vector a_list = { 2, 325, 9375, 28178, 450775, 9780504, 1795265022 }; // n - 1 = d * 2^s (d は奇数) long long d = (n - 1) / ((n - 1) & (1 - n)); for (long long a : a_list) { long long t = d; a = detail::mod_pow(a, t, n); if (a == 0 || a == 1) continue; while (a != n - 1) { t *= 2; if (t == n - 1) return false; a = static_cast(static_cast(a) * a % n); if (a == 1) return false; } } return true; } } // namespace kwm_t::math #endif // KWM_T_MATH_IS_PRIME_HPP int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int a, b; cin >> a >> b;; int x = a * 100 + b; if (kwm_t::math::is_prime(x))cout << "Yes" << endl; else cout << "No" << endl; return 0; }