#include #include using namespace std; int hws(int x) { int s = 0; while (x != 0) { s = s * 10 + x % 10; x = x / 10; } return s; } bool ss(int a) { if (a < 2) { return 0; } for (int i = 2; i * i <= a; i++) { if (a % i == 0) { return 0; } } return 1; }
int main() { int a, b; cin >> a >> b; for (int i = a; i <= b; i++) { if (hws(i) == i && ss(i)) { cout << i << endl; } } }