Subscribe to xor-logic's Blog        RSS Feed
- - - - -

Improving on standard Prime Checkers

Icon Leave Comment
Every algorithm I've seen to determine whether or not a number is prime (including the ones I've written) have pretty much been the following with cosmetic changes:
public boolean isPrime(int n) {   for (int i = 2; i < (n/2); i++) {      if (n%i == 0)         return false;   }   return true;}
...

Page 1 of 1

October 2014

S M T W T F S
   1 2 34
567891011
12131415161718
19202122232425
262728293031 

Tags

    Recent Entries

    Search My Blog

    0 user(s) viewing

    0 Guests
    0 member(s)
    0 anonymous member(s)