Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
8
Task/Semiprime/Python/semiprime-1.py
Normal file
8
Task/Semiprime/Python/semiprime-1.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
from prime_decomposition import decompose
|
||||
|
||||
def semiprime(n):
|
||||
d = decompose(n)
|
||||
try:
|
||||
return next(d) * next(d) == n
|
||||
except StopIteration:
|
||||
return False
|
||||
5
Task/Semiprime/Python/semiprime-2.py
Normal file
5
Task/Semiprime/Python/semiprime-2.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
>>> semiprime(1679)
|
||||
True
|
||||
>>> [n for n in range(1,101) if semiprime(n)]
|
||||
[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]
|
||||
>>>
|
||||
Loading…
Add table
Add a link
Reference in a new issue