![]() every number can be written as: number (n) = ‘half’ x 2.You don’t need to check every number from 2 to 100, you can stop with your checks at 50, which is the half of 100. If you reach a number beyond ‘half’ of n’s value, you’d need to multiply it by something smaller - but there’s nothing smaller than 2. So you don’t need to look further than the half of the number. Looking for prime number is a common exercise not just in mathematics, but also in programming, where the goal is learning how to devise and optimize an algorithm.Ī list of prime numbers up to one thousand: We can get even smarter than this: you don’t even need to check until half of the number, you only need to check to its square root (√n). Prime numbers may seem like just a new quirk, but mathematicians have been fascinated with them for millennia (as we’ll see in a bit). They have several properties that make them special - here are just a few of them. ![]() ![]() The sequence of prime numbers never ends. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |