Presentation is loading. Please wait.

Presentation is loading. Please wait.

A combination of two similar yet different madness…

Similar presentations


Presentation on theme: "A combination of two similar yet different madness…"— Presentation transcript:

1 A combination of two similar yet different madness…

2  Basic concepts ◦ If a number is even, apart from 2 it is not a prime ◦ If a number is odd, its factors can be 3, 5, 7, 9, … We can essentially eliminate all the even factors ◦ *** (Extra info.) The number is a prime if all factors up till sqrt (number) is not divisible by that number ◦ E.g. number is 61, if 2, 3, 4, 5, 6, 7, 8 cannot divide the number, then there is no way another factor can occur in the range 9 to 61.

3

4  Basic concepts: ◦ A number still has factors if it is not 1 ◦ For the current number, print out its smallest factor ◦ Then divide the number by its factor ◦ Repeat the process until the number is 1 ◦ *** (Optional) To print out the “x”, check if the number is not 1 (means still have factors) and print out “ x “.

5

6  Basic concepts: ◦ Divide the number by 2 repeatedly until it has no more factors of 2 ◦ Repeat the process for 3 and 5 ◦ If the resultant number is 1, means the number has no other factors and is a Hamming Number

7

8

9


Download ppt "A combination of two similar yet different madness…"

Similar presentations


Ads by Google