File tree Expand file tree Collapse file tree 1 file changed +21
-17
lines changed Expand file tree Collapse file tree 1 file changed +21
-17
lines changed Original file line number Diff line number Diff line change 11"""
2- In the ancient city of Numeria,
3- legends speak of an oracle whose whispers
4- could bend the very fabric of mathematics.
5- Travelers from distant lands would bring
6- her a number, and in return, she would reveal
2+ In the ancient city of Numeria,
3+ legends speak of an oracle whose whispers
4+ could bend the very fabric of mathematics.
5+ Travelers from distant lands would bring
6+ her a number, and in return, she would reveal
77its future: the very next prime number.
8- Your task is to embody the oracle's wisdom.
8+ Your task is to embody the oracle's wisdom.
99You will be given a number.
10- You must find the smallest prime number
10+ You must find the smallest prime number
1111that is strictly greater than it.
1212"""
13+
14+
1315def check_prime (n ):
14- if n <= 1 :
16+ if n <= 1 :
1517 return False
16- if n <= 3 :
18+ if n <= 3 :
1719 return True
18- if n % 2 == 0 or n % 3 == 0 :
20+ if n % 2 == 0 or n % 3 == 0 :
1921 return False
20- temp = 5
21- while temp * temp <= n :
22- if n % temp == 0 or n % (temp + 2 ) == 0 :
22+ temp = 5
23+ while temp * temp <= n :
24+ if n % temp == 0 or n % (temp + 2 ) == 0 :
2325 return False
24- temp += 6
26+ temp += 6
2527 return True
26- n = int (input ())
27- next_prime = n + 1
28+
29+
30+ n = int (input ())
31+ next_prime = n + 1
2832while not check_prime (next_prime ):
29- next_prime += 1
33+ next_prime += 1
3034print (next_prime )
You can’t perform that action at this time.
0 commit comments