Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Calculating the Sieve of Eratosthenes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thimo Neumann
Calculating the Sieve of Eratosthenes
Commits
6ac91086
Verified
Commit
6ac91086
authored
4 years ago
by
Thimo Neumann
Browse files
Options
Downloads
Patches
Plain Diff
Add explanation for sieve of eratosthenes
parent
4d294fe2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
Main.hs
+1
-1
1 addition, 1 deletion
Main.hs
TheSieveOfEratosthenes.md
+18
-0
18 additions, 0 deletions
TheSieveOfEratosthenes.md
with
20 additions
and
1 deletion
.gitignore
+
1
−
0
View file @
6ac91086
# Own:
*.exe
.idea
# From https://raw.githubusercontent.com/github/gitignore/master/Haskell.gitignore
dist
...
...
This diff is collapsed.
Click to expand it.
Main.hs
+
1
−
1
View file @
6ac91086
import
SieveOfEratosthenes
main
=
putStrLn
(
show
(
take
10
(
primes
)
)
)
main
=
putStrLn
(
"First 9 prime numbers: "
++
(
show
(
take
9
(
primes
)
)
)
)
This diff is collapsed.
Click to expand it.
TheSieveOfEratosthenes.md
0 → 100644
+
18
−
0
View file @
6ac91086
# The Sieve of Eratosthenes
1.
Write down the successive "plurals": 2, 3, 4, ...
2.
Repeat:
1.
Take the first number that is not circled or crossed out.
2.
Circle it.
3.
Cross out its proper multiples.
3.
What is left (i.e. the circled numbers) are the successive prime numbers.
**Example**
```
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ...
(2) 3 x 5 x 7 x 9 xx 11 xx 13 xx 15 xx 17 xx 19 xx 21 xx 23 xx 25 ...
(2) (3) 5 7 x 11 13 xx 17 19 xx 23 25 ...
(2) (3) (5) 7 11 13 17 19 23 xx ...
...
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment