Company: Skyforce_8dec
Difficulty: medium
MEX-P MEX-P Problem Description You are given an array A containing N integers. We define the MEX-P of an array B as: The minimum prime that does not divide all the elements of the array. For example, let array B = [2, 4, 8] . The MEX-P for this array will be MEX-P(B) = 3 . As 3 does not divide 2, and 2 (the only smaller prime) divides all elements of B. You have to calculate the sum of the MEX-P of all the possible subarrays of array A . Task Output the sum of the MEX-P of all possible subarrays of A . Input Format The first line will contain a single integer T , the number of test cases. For each test case: The first line will contain a single integer N . The second line will contain N space-separated integers representing array A . Output Format The output will contain a single line representing the sum of the MEX-P of all subarrays of array A . Constraints 1 ≤ T ≤ 100 1 ≤ N ≤ 10 5 1 ≤ A i ≤ 10 9 Σ N i ≤ 10 5 for 1 ≤ i ≤ T Sample Input 1 4 2 4 8 3 Sa