On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano <st...@pearwood.info> wrote:
2 does count because it isn't divisible by 3. The question states, "[count] how many positive integers less than N are not divisible
by 2,3
or 5". Two is not divisible by 3, so "not divisible by 2,3 or 5" is
true,
so two gets counted.

The first number which is divisible by *all* of 2, 3 and 5 (i.e.
fails
the test, and therefore doesn't get counted) is 30. The next few
that
fail the test are 60, 90, 120, 150, 180, 210, 240, 270, 300, ... Remember, these are the numbers which should not be counted.

> I count 1, not 6

Out of curiosity, which number did you count?

1 of course. It's the only one that's not divisible by any of the factors.

Apparently we disagree about precedence and associativity in English. I believe the not applies to the result of (divisible by 2, 3, or 5), so I'd count 1, 7, 11, 13, 17, 19, 23. The first nonprime would be 49.

If I were trying to get the series you describe, I'd phrase it as "Not divisible by 2, and not divisible by 3, and not divisible by 5"

--
DaveA

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to