CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of prime numbers
C++
bool isPrimef(int n){
    if (n == 1     ) return false;
    if (n <  4     ) return true;
    if (n %  2 == 0) return false;
    if (n <  9     ) return true;
    if (n %  3 == 0) return false;
    else{
        int r = std::sqrt(n);
        int f = 5;
        while (f <= r){
by Pella86   December 23, 2011 @ 5:31pm
89 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate