Semiprime: Difference between revisions
J
(J) |
|||
Line 40:
[f1, f2] -> f1 * f2 == n
otherwise -> False</lang>
=={{header|J}}==
Implementation:
<lang J>isSemiPrime=: 2 = #@q: ::0:"0</lang>
Example use: find all semiprimes less than 100:
<lang J> I. isSemiPrime i.100
4 6 9 10 14 15 21 22 25 26 33 34 35 38 39 46 49 51 55 57 58 62 65 69 74 77 82 85 86 87 91 93 94 95</lang>
Description: factor the number and count the primes in the factorization, is it 2?
=={{header|Perl 6}}==
|