Tuesday, June 23, 2009

Ready for Prime Time?


Taking a walk down Geek Lane this week with a look at exploring Prime Numbers in Excel. Specifically, Mersenne Prime Numbers. A Mersenne Number is a number in the form of Mn=(2^n)-1. Although Excel is not robust enough to explore this in depth, it is nonetheless interesting to see what can be done.

So, assuming you have a bit of geek in you, here is what you can do.

1. Create a simple spreadsheet with a similar format to the following starting in A1:

2. Starting in A3, insert consecutive numbers starting with 2 into Column A.
3. In B3, place the formula, “=(2^A3)-1”and copy down with relative references
4. Go to the Blue Moose Technology site (Thanks, Blue Moose!) and copy the prime code into a new module in your workbook
5. Finally, use the resulting “ISPRIME” custom function starting in C3 to determine if the numbers in the B column are prime

Obviously, this exercise is not of interest to everyone, but if you find both Excel and Prime Numbers exciting, give it a try. You might find you are “Ready for Prime Time”.

No comments: