Subham and Surya
All submissions for this problem are available.
Subham and Surya are friends.Subham decided to gift a bot on Surya's birthday.So he went to a shop where there were N-1 bots each having a number from 2 to N. After going there he saw that all bots were trying to kill each other, then he noticed that bots with number Y are killing the bots with number 2Y,3Y,4Y,5Y.....After some time the killing stopped and some bots didn't get killed.
After seeing this he thought of buying all of them but he didn't have enough money, so he decided to buy only those bots who are alive and whose numbers are palindromic like 111,131, 121. Being his friend you have to tell him which bots he can buy.
Input FormatFirst line consists of P denoting number of test cases.
Each test case consists of a single integer denoting N denoting n-1 bots having a number from 2 to N.
Output FormatPrint the bots he can buy.
Constraints1 $\leq$ P $\leq$ 100
2 $\leq$ N $\leq$ 10^7
2 3 5
In the first case, the coder will buy 3 bots having number 2,3 and 5.
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, PAS fpc, PAS gpc, RUBY, PHP, NODEJS, rust, SCALA, swift, PERL, WSPC, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, TCL, kotlin, PERL6, TEXT, SCM chicken, PYP3|
Fetching successful submissions
If you are still having problems, see a sample solution here.