Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/E869120/math-algorithm-book
/ isprime
Function
isprime
codes/python/Code_3_01_1.py:2–6 ·
view source on GitHub ↗
(N)
Source
from the content-addressed store, hash-verified
1
# 2 以上の整数 N に対し、N が素数であれば true、素数でなければ false を返す関数
2
def
isprime(N):
3
for
i in range(2, N):
4
if
N % i == 0:
5
return
False
# N が i で割り切れた場合、この時点で素数ではないと分かる
6
return
True
7
8
N = int(input())
9
if
isprime(N):
Callers
1
Code_3_01_1.py
File · 0.70
Calls
no outgoing calls
Tested by
no test coverage detected