Given a number N, you need to find if its digital root is prime or not. DigitalRoot of a number is the repetitive sum of its digits until we get a single digit number.
The first line of the input contains a single integer T, denoting the number of test cases. Then T test case follows. Each testcase contains a single line having N as input.
For each testcase, print 1 if the digitalRoot(N) is prime, else print 0.
1 <= T <= 110
1 <= N <= 104
For testcase 1: DigitalRoot(89)=>17=>1+7=>8; not a prime.
For testcase 3: DigitalRoot(12)=>1+2=>3; a prime number.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.