Transform to prime
Submissions: 7072   Accuracy:

29.88%

  Difficulty: Basic   Marks: 1

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. The T testcases follow. 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
Author: saksham seth


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.



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


to report an issue on this page.