
ZOJ Problem Set  3014
Recently, DD found that 9875321 was a very special number, and it has three properties: (1) 9875321 is a prime number. (2) reverse it, we get 1235789, which is also a prime number. (3) the digits of 9875321 are in strictly descreasing order. Above all, for all the decimal numbers with the three properties, 9875321 is the maximal one. So we say 9875321 is very special. Now, given N (2<=N<=16), find the Nbased very special number. For N>10, we use capitals 'A', 'B', 'C'... Input Each line of input is a test case, which consists of only one number N. Output For each line of input you will output only one line for the Nband very special number. If the Nband very special number doesn't exist, output "not special". Sample Input 3 10 Sample Output 21 9875321 Author: CUI, Tianyi Source: ZOJ Monthly, August 2008 