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

    Simple check if a number is prime. See also http://fssnip.net/2w.

    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