E D R S I H C RSS
ID
Password
Join
The wise shepherd never trusts his flock to a smiling wolf.

FrontPage isPrime

No older revisions available



int isPrime(int num) {
	if ( num <= 1 ) { return 0; }
	if ( num <= 3 ) { return 1; }
	if ( (num & 0x1) == 0 ) { return 0; }

	int end = sqrt(num);
	for (register int i = 3; i <= end; ++i ) {
		if ( end % i ) return 0;
	}
	return 1;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2016-04-13 18:03:28
Processing time 0.2800 sec