#K62847. Sum of Non-Prime Numbers

    ID: 31622 Type: Default 1000ms 256MiB

Sum of Non-Prime Numbers

Sum of Non-Prime Numbers

You are given \(T\) test cases. Each test case begins with an integer \(N\) representing the number of elements in the array, followed by \(N\) space-separated integers. Your task is to compute the sum of all non-prime numbers in each array.

A number \(n\) is considered prime if \(n > 1\) and its only positive divisors are 1 and \(n\). In other words, \(n\) is prime if and only if it has no divisors other than 1 and \(n\) itself.

For each test case, print the result on a new line.

inputFormat

The input is read from standard input (stdin) and follows this format:

T
N
a1 a2 ... aN
N
a1 a2 ... aN
...

Where:

  • T: the number of test cases.
  • N: the number of elements in the current array.
  • a1, a2, ..., aN: the integer elements of the array.

outputFormat

For each test case, output a single integer representing the sum of the non‐prime numbers found in the array. Each result should be printed on a new line.

## sample
3
5
1 2 3 4 5
4
20 22 25 27
3
2 3 5
5

94 0

</p>