mick lynch wrote:...I need to learn a computer language ...
Paul Beckett wrote:Think about your conditional logic. Hint: You have four conditions, the first two are "equal" and "not equal".
Campbell Ritchie wrote:Please post working code, which we can actually execute and understand the output of. You ought to have posted the printing method as well, so we can see a set of prime numbers
Campbell Ritchie wrote:Are you using false == prime? If so, what about 0, which is an exact multiple of every number, but is not a "natural" number? And what about 1, which doesn't divide by any other numbers, but is not usually considered prime?
I seemed to get a different result from yours when I printed the numbers out.
I think the squaring allows for that. But surely it is simpler to use the square root?