Problem
Given an array numbers of natural number elements, write a function solution that returns the count of prime numbers in numbers. (A prime number is defined as a natural number greater than 1 that has only 1 and itself as divisors.)
Constraints
- Each element in
numbersis a natural number between 2 and 500. numbersis not empty, and its length does not exceed 100.
Test Case
| Test Case Number | numbers | return |
|---|---|---|
| 1 | [2, 3, 4, 5] | 3 |
| 2 | [100, 200, 300] | 0 |
| 3 | [21, 47, 33, 51, 60, 99] | 1 |
Explanation for Test Case 1
- The prime numbers in
numbersare2,3, and5, so the count is3.
Explanation for Test Case 2
- There are no prime numbers in
numbers, so the return value is0.
Explanation for Test Case 3
- The prime number in
numbersis47, so the count is1.