Difficulty:
Given a positive integer and a non-empty list of prime numbers, determine if the number only consists of those prime factors. For example, if the list of prime numbers is
[2, 3, 5, 7]
, the number140 = 2^2 * 5 * 7
has the right prime factors, while26 = 2 * 13
does not.
primeFactors(140, [ 2, 3, 5, 7 ]);
true