# Newbie - Trying to Help a Friend

Alister alister.ware at ntlworld.com
Wed Nov 20 10:29:44 CET 2013

```On Wed, 20 Nov 2013 00:54:28 -0500, Dave Angel wrote:

> On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano <steve at 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"

This ambiguity is a great example of why teachers (and enayone else
responsible for specifying a programming project) should take greater
if it is to late to ask for clarification (the correct step in a real
world case) I suggest you write 2 programs 1 for each interpretation, it
will be good for your personal learning even if the teacher does not give
any extra credit.

--
I am practicing a fine point of ethics.  It is acceptable to shoot back.
It is not acceptable to shoot first.
-- Zed Pobre

```