>>That will always work up to a certain point only: if you want to test numbers up to 1e6, whether they are prime numbers, then your table of basic prime numbers must go up to 1e3. For numbers above 1e6, your table won't work any longer.
>>
>>Hilmar.
>
>Right, thanks.
Oh, by the way: the reason for limiting to sqrt(number) is the following:
If my number has one factor larger than sqrt(number), then it must needs have another factor, which would then be smaller than sqrt(number). Which would already have been discovered earlier in the loop.
For instance, one factor of 77 is 11 (larger than sqrt(77)). But this implies that the other factor (7) is smaller than sqrt(77).
Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)