On 20 Nov 2013 00:17:23 GMT, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote:
problem by hand. I'll get you started by solving the problem for 7.




Positive integers less than 23 are 1, 2, 3, 4, 5, 6. So let's start checking them for divisors:

Where did 23 come from?


- 1 is not divisible by 2, 3 or 5, so we count one number.
- 2 is divisible by 2, but not by 3 or 5, so we count two numbers.

2 doesn't count because it's divisible by 2.
- 3 is not divisible by 2, so we count three numbers.

3 doesn't count because it's divisible by 3

- 4 is divisible by 2, but not 3 or 5, so we count four numbers

And so on.

- 5 is not divisible by 2, so we count five numbers.
- 6 is divisible by 2 and 3, but not by 5, so we count six numbers.


I count 1, not 6



And the answer is: 6.

--
DaveA

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

Reply via email to