diff --git a/Algo/B2/Exercises/Repetitive tutorial.md b/Algo/B2/Exercises/Repetitive tutorial.md index c320b2e..cddd208 100644 --- a/Algo/B2/Exercises/Repetitive tutorial.md +++ b/Algo/B2/Exercises/Repetitive tutorial.md @@ -214,6 +214,11 @@ def prime(n: int) -> int: raise Exception("prime: n<= 1") elif n % 2 == 0: return n == 2 + else: + d = 3 + while d*d <= n and n % d!= 0: + d += 2 + return d*d > n ## Exercise 3.3 ```python def quotient(a: int, b: int) -> int: