Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 377cf55

Browse files
namangupOmkarPathak
authored andcommitted
Modified the algorithm to take half of the previous time (#13)
1 parent 38f7b66 commit 377cf55

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎CompetitiveProgramming/HackerEarth/Basics_Of_Input_Output/P04_PrimeNumber.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
import math
1616

1717
userInput = int(input())
18-
for i in range(2, userInput + 1):
18+
if userInput>2
19+
print("2",end = ' ')
20+
for i in range(3, userInput + 2):
1921
check = 0
2022
for j in range(2, int(math.sqrt(i))+ 1):
2123
if i % j == 0:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /