~cpp 
#include <stdio.h>
#include <cmath> 
#include <ctime> 

bool IsPrime(int n) 
{ 
	for(int j = 3 ; j <= sqrt(n) ; j+=2) 
	{ 
		if(n % j == 0) 
			return false; 
	} 
	return true; 
} 

int main() 
{ 
	printf("%d %d",2,3); 
	for(int i = 5 ; i <= 50000 ; i+=2) 
	{ 
		if(i % 3 == 0) 
			continue; 
		else if(IsPrime(i)) 
			printf("%d ",i); 
	}        
	return 0; 
}
----
소수구하기
Retrieved from http://wiki.zeropage.org/wiki.php/소수구하기/인수
last modified 2021-02-07 05:30:13