Tirsvad c59fdf04cf
Publish wiki / publish-wiki (push) Successful in 19s
Publish wiki / wiki (push) Successful in 19s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 5s
Merge pull request 'Wiki in English, Danish and Malay, AVX2 explanation, README' (#3) from docs/wiki-and-dist-build into main
2026-10-19 19:42:17 +02:00
2026-10-19 17:40:04 +02:00

prime-numbers-c

Lists every prime number from 0 to 1,000,000 and reports how long the search took. It shows how fast a CPU is, but the result depends on how the program is written: algorithm, instruction set (here AVX2), compiler and flags.

Example result on a 13th Gen Intel(R) Core(TM) i5-13600K:

Found 78498 primes from 0 to 1000000 in 20.977 ms

Build and run

Needs gcc (Linux, or MinGW-w64 / MSYS2 on Windows), make and a CPU with AVX2.

make
make run
make clean

The executable is built into dist/. The primes go to standard output and the timing line to standard error, so this saves the list and still shows the time:

./dist/prime_avx2 > primes.txt

Layout

Path Content
src/prime_avx2.c the program
Makefile build rules
docs/wiki/ wiki pages, published to the Gitea wiki by .gitea/workflows/publish-wiki.yml

Documentation

See the wiki: Description, Results and Build and run.

License

See LICENSE.

S
Description
Lists all primes from 0 to 1,000,000 using AVX2 in C and times it, to show CPU speed depends on how it is programmed
Readme AGPL-3.0
68 KiB
Languages
C 81.9%
Makefile 18.1%