I also struggle with Math!!
A number cannot be prime if it is a perfect square.
16 is perfect square of 4. 16 not prime.
A number is only prime if two other integers cannot be multiplied together to equal that number.
Take 37, sqrt = 6.08
- So as you iterate over the numbers..
- 37 % 2 == 0, nope. Another way to say is that 2 * something = 37 with no remainder
- 37 % 3 == 0, nope. Another way to say is that 3 * something = 37 with no remainder
- 37 % 4 == 0, nope. Another way to say is that 4 * something = 37 with no remainder
- 37 % 5 == 0, nope. Another way to say is that 5 * something = 37 with no remainder
- 37 % 6 == 0, nope. Another way to say is that 6 * something = 37 with no remainder
Our next number would be 7. But we know that
6.08 times any number smaller than 6.08 is < 37
and 6.08 times any number larger than 6.08 is > 37
So, in our next iteration, 7 * something = 37 with no remainder, for that something to multiply 7 and make 37, would *have* to be smaller than 6.08, and we already tested all those.
Does that sound right?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.