SOLVE

LATER

Bob and Mathematics

Problem

Editorial

Analytics

Bob was very good at his mathematics. He scored A+ grade in every mathematical subjects. To challenge him his teacher gave him to solve following question :

You are given an array of n positive integers where all integers are less than or equals to 10^6. Now you have to calculate the product of (number of primes + 2) of all subsets of that array. Two subsets of array are considered different if there is an element with index i in one subset such that there is no such element with same index i in other subset.

**Print answer modulo (1000000007)**

Lets clear it with an example :

Take an array = [2,4]

Now lets see all subsets

{2} ----> noOfPrimes = 1 So (1+2) = 3

{4} -----> noOfPrimes = 0 So (0+2) = 2

{2,4} -----> noOfPrimes = 1 So (1+2) = 3

{} -----> noOfPrimes = 0 So (0+2) = 2

So final answer is `3*2*3*2 = 36`

**Note:** For empty subset number of primes is 0.

**Constraints :**

1 <= n <= 10^3

arr[i] <= 10^6

t <= 1000

**Input Format :**

First line contains t - no of test cases. For each test cases there are two lines. First line contains n - size of array and second line contains array elements.

**Output Format :**

Print required answer modulo 1000000007 for each test cases.

**Setter : Aayush Kapadia**

**Tester : Tanmay Patel**

Time Limit:
1.5 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
C,
C++,
C++14,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Julia,
Kotlin,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Visual Basic

Initializing Code Editor...

{"c544c3d": "/pagelets/recommended-problems/algorithm/bob-and-mathematics-2/", "8be3738": "/pagelets/problems-hint/algorithm/bob-and-mathematics-2/", "0b1a967": "/pagelets/suggested-problems/algorithm/bob-and-mathematics-2/", "e6ffe65": "/pagelets/problem-author-tester/algorithm/bob-and-mathematics-2/", "e559dce": "/pagelets/show-submission/algorithm/bob-and-mathematics-2/"}

realtime.hackerearth.com

80

38b2fcee945a24bb3b443637930d594f9c554691

58a29e5cae2309f04b28

/realtime/pusher/auth/