SP16758 SNGDIV69 - Divisible by 6 and 9
Description
Let num (> 0) be n (> 0) digit(s) positive integer. num is represented as N $ _{1} $ N $ _{2} $ N $ _{3} $ N $ _{4} $ .....N $ _{n-2} $ N $ _{n-1} $ N $ _{n} $ , where N $ _{i} $ is the i $ ^{th} $ digit of num from left (0 < i < n+1). Digits of num are sorted in descending and ascending order respectively and this sorting generates two new positive integers num $ _{dsc} $ and num $ _{asc} $ . The difference between the numbers is diff $ _{num} $ = num $ _{dsc} $ - num $ _{asc} $ , if diff $ _{num} $ is divisible by both 6 and 9, then we say that num is a magic number. Let sum $ _{digits} $ is defined as following
**number = diff $ _{num} $**
**do {
number = sum of digits of number** } while (number > 10)
sum $ _{digits} $ = number
Input Format
First line of input is t (< 101), total number of test cases. Each test case has n (< 10001) as its first input and next n lines contains num (< 10 $ ^{100} $ ).
Output Format
For each test case, write exactly n lines containing two/three specifications without space :
(i) **Y** if num is magic number otherwise **N**.
(ii) Let sum $ _{digits} $ = c, **ZER** if c is 0 (zero), **ONE** if c is 1 (one) if c > 1, **EP** if c is even and prime, **ENP** if c is even but not prime, **OP** if c is odd and prime or **ONP** if c is odd but not prime.
(iii) Let diff $ _{num} $ = d, If num is not a magic number then print **EQL** if d is not divisible by both 6 and 9, **LTN** if d is not divisible by 6 only, **GTN** if d is not divisible by 9 only.