Semiprime: Difference between revisions
Content deleted Content added
add gw basic |
Alextretyak (talk | contribs) Added 11l |
||
Line 28: | Line 28: | ||
* The OEIS sequence: [[oeis:A001358|A001358: semiprimes]] which has a shorter definition: ''the product of two primes''. |
* The OEIS sequence: [[oeis:A001358|A001358: semiprimes]] which has a shorter definition: ''the product of two primes''. |
||
<br><br> |
<br><br> |
||
=={{header|11l}}== |
|||
{{trans|C++}} |
|||
<lang 11l>F is_semiprime(=c) |
|||
V a = 2 |
|||
V b = 0 |
|||
L b < 3 & c != 1 |
|||
I c % a == 0 |
|||
c /= a |
|||
b++ |
|||
E |
|||
a++ |
|||
R b == 2 |
|||
print((1..100).filter(n -> is_semiprime(n)))</lang> |
|||
{{out}} |
|||
<pre> |
|||
[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] |
|||
</pre> |
|||
=={{header|360 Assembly}}== |
=={{header|360 Assembly}}== |