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