A Bit of Maths, a Bit of UML...

A bit of Maths

For this tutorial we will be considering three types of number prime numbers, mersenne prime and perfect numbers.

A Prime number is any number that is only divisible by itself and one. So examples of prime number are { 1 , 2 , 3 , 5 , 7 , 1 1 . . . }

A Mersenne prime is a special type of prime number in that it is a prime number that can be written in the form of 2 k - 1 . Example of the first few mersenne number are { 1 , 3 , 7 , 15 , 31 , 63 , 127 , 255 . . . }

A Perfect numbers, on the other hand is, that which is equal to the sum of it parts. Put another way, a whole number is perfect if it is equal to the sum of its proper divisors. So for example the number 6 is perfect because it proper divisors are 1, 2, 3 and 1 + 2 + 3 = 6. So also are 28 (1 + 2 + 4 + 7 +14); 496 and 8128. There numbers constitute the first four perfect numbers and as is evident for the series there are not that many of them.

So what is the relationship between these numbers? From its definition it is clear that a mersenne prime is also a prime numbers. A consequence of this is, that k in the 2 k - 1 equation must also be prime. Also, a relationship between prime numbers and perfect numbers had been known since antiquity and formulated by Euclid in the following Theorem.

Theorem. If 2 k - 1 is prime and if N = 2 k - 1 ( 2 k - 1 ) , then N is perfect.

But it wasn't until almost 2000 year later that the exact relationship between these types of numbers was resolved by Euler in the following theorem.

Theorem. If N is an even perfect number, then N = 2 k - 1 ( 2 k - 1 ) , where 2 k - 1 is prime

In plain language an even perfect number has a mesenne prime associated with it.

A bit of UML

A mersenne prime then is a special type of prime number. In UML this is represented as an 'is a' relationship i.e. A mersenne prime is a special type of prime number. Also since k in 2 k - 1 is also prime, then there is also an 'has a' relationship i.e. A Mersenne number has a Prime number.

From Euler theorem on perfect numbers above it is clear that there are two types Odd Perfect numbers and Even Perfect numbers. Again this can be represented in UML as follows:

It is interesting to note that an odd perfect number has never been found even though some extraordinary properties about them are known, among which are:

Look at item three on the list; imagine trying to do some long division sums in your head with that number

Finally, again from Eular theorem, perfect numbers are related to prime numbers in that an all even perfect number can be expressed in the form N = 2 k - 1 ( 2 k - 1 ) i.e. N = 2 k - 1 (a mersenne number). Therefore every even perfect number has a mersenne number. Once more in UML this can be diagrammatically depicted as follows: