From 467ed5c454f5983acfd1f15371d8e8671e67bf1b Mon Sep 17 00:00:00 2001 From: Lukas Baumann Date: Wed, 17 Feb 2021 14:58:37 +0100 Subject: [PATCH] Create 3 - Primed for Takeoff.py --- 18/3 - Primed for Takeoff.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 18/3 - Primed for Takeoff.py diff --git a/18/3 - Primed for Takeoff.py b/18/3 - Primed for Takeoff.py new file mode 100644 index 0000000..8d9bcae --- /dev/null +++ b/18/3 - Primed for Takeoff.py @@ -0,0 +1,10 @@ +isPrime = [i%2==1 for i in range(1000001)] +isPrime[1] = False +isPrime[2] = True +l = len(isPrime) +for i in range(3, l, 2): + if isPrime[i] == False: + continue + else: + for i in range(i*2, l, i): + isPrime[i] = False