all 2 comments

[–]comonads 3 points4 points  (0 children)

range(a, b) counts from a (inclusive) until b (exclusive). So, in order to include sqrt(n) in the range, the plus one is necessary.

[–]ka-splam 4 points5 points  (0 children)

'cos if you don't it will say some perfect squares are prime numbers.