values. A pick is a set of array elements chosen by position; two picks are different when their sets of chosen positions differ.
A pick is valid when the product of its elements equals a product of one or more **distinct** primes. For example, 6 = 2·3 and 7 qualify, while 4 = 2·2 and 1 do not.
Return the number of valid picks modulo 10⁹ + 7.values=[1, 6, 4, 5] → 6
The valid picks are {6}, {5}, {6, 5} (product 30 = 2·3·5), and the same three with the 1 added: 6 in total. The 4 can never be used, since 4 = 2·2.
values=[3, 3, 10] → 5
{3} can be taken two ways (either 3), {10} one way, {3, 10} two ways. Both 3s together give 9 = 3·3, which does not count. 5 in total.
values=[1, 1, 9] → 0
A product of ones is 1, which has no prime factors, and 9 = 3·3. There are no valid picks.
values=[1, 6, 4, 5]
6
Run checks the first 3 tests in your browser. Submit checks all 94 tests on the server, hidden ones included.