Tuesday, March 11, 2008

I Blinded Her With Science

For my computer science assignment, I need to create a program that find the first four perfect numbers. A perfect number is one that the sum of the factors equals the number (for example: 1+2+3=6). In one of my math text books, I found a formula that calculates perfect numbers using prime numbers. My CS was warily about me using this formula and I'm not sure why.

The first four perfect numbers are
6
28
496
8128

What would you rather do: find the factors for 8128 numbers and then add the factors or find the first four prime numbers? My program runs faster than the program she would prefer I create. Doesn't everyone want a computer program that no only works but works quickly? My program works perfectly, fulfills all requirements of the assignment question so I'm keeping it that way it is. I'm not going to rewrite a program that is perfectly fine because of preference. I created a computer program that uses Fermat's Little Theorem and the Euclid-Euler Theorem, I should get bonus marks for that.

1 comment:

The Wisper said...

I like your way. :)