{"trustable":true,"sections":[{"title":"Description","value":{"format":"MD","content":"Because $151$ is both a prime number and a palindrome (reads the same from left to right and right to left), so $151$ is a palindrome prime.\n\nWrite a program to find all palindrome primes within the range of $[a,b] (5 \\le a \u003c b \\le 100,000,000)$ (up to one hundred million)."}},{"title":"Input","value":{"format":"MD","content":"The first line contains two positive integers $a$ and $b$."}},{"title":"Output","value":{"format":"MD","content":"Output a list of palindrome primes, one per line."}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5 500\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5\n7\n11\n101\n131\n151\n181\n191\n313\n353\n373\n383\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Hint","value":{"format":"MD","content":"Hint 1: Generate the palindromes and see if they are prime.\n\nHint 2: Generate palindromes by combining digits properly. You might need more than one of the loops like below.\n\nTo generate palindromes of length $5$:\n\n```cpp\nfor (d1 \u003d 1; d1 \u003c\u003d 9; d1+\u003d2) { // Only odd numbers can be prime\n for (d2 \u003d 0; d2 \u003c\u003d 9; d2++) {\n for (d3 \u003d 0; d3 \u003c\u003d 9; d3++) {\n palindrome \u003d 10000*d1 + 1000*d2 +100*d3 + 10*d2 + d1;//(Processing palindrome...)\n }\n }\n }\n\n```"}}]}