BETA

Difficulty Level: Basic

Total Submissions: 991 Accuracy:

16.35%

Transform to prime
         

Given an array of n integers. Find minimum number to be inserted in array, so that sum of all elements of array becomes prime. If sum is already prime, then return 0.

Input:
First line consists of T test cases. First line of every test case consists of N, denoting number of elements of array. Second line of every test case consists of elements of array.

Output:
Single line output, print the required answer.

Constraints:
1<=T<=100
1<=N<=1000

Example:
Input:

1
5
2 4 6 8 12
Output:
5

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.