#K41392. Prime-Friend Numbers

    ID: 26855 Type: Default 1000ms 256MiB

Prime-Friend Numbers

Prime-Friend Numbers

You are given a list of integers for each test case. A number is called a prime-friend if the sum of its digits is a prime number. Recall that a prime number \(p\) is a positive integer greater than 1 that has no positive divisors other than 1 and itself. In other words, for a number \(n\), let its digit sum be defined as \(S(n)=\sum_{i=1}^{k} d_i\), where \(d_i\) are the digits of \(n\). If \(S(n)\) is prime, then \(n\) is called a prime-friend.

Your task is to determine the count of prime-friend numbers for each test case.

Input Format: The first line contains an integer \(T\) (the number of test cases). For each test case, the first line contains an integer \(N\) denoting the number of elements, and the next line contains \(N\) space-separated integers.

Output Format: For each test case, print the number of prime-friend numbers on a new line.

inputFormat

The input is read from standard input (stdin) and has the following format:

  • The first line contains an integer \(T\), the number of test cases.
  • Every test case consists of two lines: the first line has an integer \(N\) (the number of numbers), and the next line contains \(N\) space-separated integers.

outputFormat

For each test case, output a single line containing the count of prime-friend numbers. The output is written to standard output (stdout).

## sample
2
4
29 31 42 57
5
11 15 13 23 25
1

3

</p>