Today we're going to write a function to generate Mersenne numbers. This is useful in searching for Mersenne primes.
ASP
function mersenne(x)
mersenne = 2^x - 1
end function
PHP
function mersenne($x)
{
return 2^$x - 1;
}
ASP and PHP code that you can use and re-use. Practical examples for real-world programming, under a Creative Commons license.
All the code examples on this blog are licensed under a Creative Commons Attribution 3.0 License.
No comments:
Post a Comment