Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thimo Neumann
Calculating the Sieve of Eratosthenes
Commits
6ac91086
Verified
Commit
6ac91086
authored
Jul 15, 2020
by
Thimo Neumann
Browse files
Add explanation for sieve of eratosthenes
parent
4d294fe2
Changes
3
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
6ac91086
# Own:
*.exe
.idea
# From https://raw.githubusercontent.com/github/gitignore/master/Haskell.gitignore
dist
...
...
Main.hs
View file @
6ac91086
import
SieveOfEratosthenes
main
=
putStrLn
(
show
(
take
10
(
primes
)
)
)
main
=
putStrLn
(
"First 9 prime numbers: "
++
(
show
(
take
9
(
primes
)
)
)
)
TheSieveOfEratosthenes.md
0 → 100644
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 ...
...
```
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment