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 62a3c5d

Browse files
Update README.md
1 parent 73ace60 commit 62a3c5d

File tree

1 file changed

+6
-6
lines changed
  • Competitive Coding/Math/Primality Test/Optimized School Method

1 file changed

+6
-6
lines changed

‎Competitive Coding/Math/Primality Test/Optimized School Method/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ Examples of first few prime numbers are {2, 3, 5, 7,...}
55

66
Examples:
77

8-
Input: n = 11
8+
**Input:** n = 11
99

10-
Output: true
10+
**Output:** true
1111

12-
Input: n = 15
12+
**Input:** n = 15
1313

14-
Output: false
14+
**Output:** false
1515

16-
Input: n = 1
16+
**Input:** n = 1
1717

18-
Output: false
18+
**Output:** false
1919

2020
A simple solution is to iterate through all numbers from 2 to n-1 and for every number check if it divides n. If we find
2121
any number that divides, we return false. Instead of checking till n, we can check till √n because a larger factor of n

0 commit comments

Comments
(0)

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