## Snippets tagged primes

• ### Millerâ€“Rabin primality test

Millerâ€“Rabin primality test is an algorithm which determines whether a given number is probable prime. For more information go to http://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test

34 people like this

Posted: 13 years ago by Cesar Mendoza

• ### Prime testing

3 people like this

Posted: 12 years ago by d95danb

• ### Folding over prime factors

Let's have some fun with higher order functions and instead of folding over a list, fold over the prime factors of a number. It can be optimized further by dividing out real primes instead of numbers of the form 6k+/-1, but it's not embarrassingly slow.

2 people like this

Posted: 12 years ago by Arjen Kopinga

• ### Prime numbers - Sieve of Eratosthenes

Basic prime number generator

3 people like this

Posted: 12 years ago by d95danb

• ### A fast sieve of Eratosthenes

A prime Eratosthenes' sieve, using a bit array and sieving only odd composites to conserve memory and keep things fast.

4 people like this

Posted: 12 years ago by Arjen Kopinga

• ### A simple sieve

A simple implementation for the sieve of Eratosthenes.

3 people like this

Posted: 11 years ago by Gab_km