- Veranstalter: Prof. Dr. Max Horn
- Termin Übung: Jeden Donnerstag 10:00 - 12:00 Uhr in PC-Labor des Mathematischen Instituts

- 2015-10-09
- Update for sheet 2: explain how "for"-loops in GAP work in more detail
- 2015-09-14
- Some cosmetic revisions
- 2014-11-06
- Add the "bad locals" example
- 2014-11-05
- Uploaded slightly revised versions of worksheets 3 and 4

- sheet0-install.pdf
- sheet1-basics.pdf
- sheet2-linAlg.pdf
- sheet3-functional.pdf
- sheet4-perms.pdf
- sheet5-misc.pdf
- sheet6-groups.pdf
- sheet7.pdf

Write a function`Sieve(n)`

which takes a positive integer`n`

, and returns a list containing all primes less or equal`n`

, in strictly ascending order. Compute this list using the sieve of Eratosthenes. Submit your solution in a file called`sieve.g`

.Your program should be able to compute

`Sieve(10^7)`

in under 20 seconds.

Hint:You can use the function`RootInt`

to compute an integer approximation of the square root of an integer (consult the manual to learn how to use it). However, it is also fine to write a solution working without it.

Hint:The function`Add`

may also be useful: It can append a single element to the end of a list (again, please consult the GAP manual for details).

`local`

properly
Autor: Max Horn