Submit Best Submissions All Submissions

399. Super Sad Numbers

Problem Statement:
The number is super sad if, the number is not prime or palindrome and the sum of its digits is not prime or palindrome.
Given x, print all super sad numbers between 2 and x inclusive.

Input Format:
T the number of test cases
T numbers each number represent x
2 < x < 10,000,000

Output Format:
For each test case, print "Case z:" at the first line, where z is the case number (one based index) then print all the super sad numbers between 2 and x inclusive each on a line

Sample Input:
2 29 40

Sample Output:
Case 1: 28 Case 2: 28 39

Added by: gammal
Added at: 2015-04-11 07:00:00 UTC
Time Limit: 1 second
Partial score: No