[python] 소수 판별 (에라토스테네스의 체)
Ver. Jupyter Notebook (Anaconda3) ▶ 소수 판별 (에라토스테네스의 체) 코딩: github JeongJaeyoung0/function Contribute to JeongJaeyoung0/function development by creating an account on GitHub. github.com # 소수 판별 import math def prime_number(n): t=[True for i in range(n+1)] # 모든 수 True로 전환 # 에라토스테네스의 체 (소수를 찾는 방법) for i in range(2,int(math.sqrt(n))+1): # 2부터 n^2+1 까지만 확인 if t[i]==True: # i가 소수인 경우 a=2 while i*a
2021.06.03