Saturday, November 22, 2008

Mersenne Numbers

Today we're going to write a function to generate Mersenne numbers. This is useful in searching for Mersenne primes.


ASP

  1. function mersenne(x)
  2.     mersenne = 2^x - 1
  3. end function

PHP

  1. function mersenne($x)
  2. {
  3.     return 2^$x - 1;
  4. }

No comments: