https://github.com/gabriel-logan/primenumbers
Repository containing code that aims to find prime numbers and displays a list of them available on the web.
https://github.com/gabriel-logan/primenumbers
c c-code learn prime prime-numbers primes student-vscode
Last synced: about 2 months ago
JSON representation
Repository containing code that aims to find prime numbers and displays a list of them available on the web.
- Host: GitHub
- URL: https://github.com/gabriel-logan/primenumbers
- Owner: gabriel-logan
- License: mit
- Created: 2024-06-18T21:36:43.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-07-04T05:43:28.000Z (10 months ago)
- Last Synced: 2025-03-16T19:12:19.760Z (about 2 months ago)
- Topics: c, c-code, learn, prime, prime-numbers, primes, student-vscode
- Language: C
- Homepage:
- Size: 23.8 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# PrimeNumbers
Repository containing code that aims to find prime numbers and displays a list of them available on the web.The idea of the repository is to create the most optimized code possible, to generate increasingly larger prime numbers and add them to the primes.txt list
## List of prime numbers
https://github.com/gabriel-logan/PrimeNumbers/blob/main/docs/primes.txt## Raw file
https://raw.githubusercontent.com/gabriel-logan/PrimeNumbers/main/docs/primes.txt## Small List of prime numbers (first 1000)
https://github.com/gabriel-logan/PrimeNumbers/blob/main/docs/small-primes-list.txt## Small List of prime numbers (first 1000) Raw file
https://raw.githubusercontent.com/gabriel-logan/PrimeNumbers/main/docs/small-primes-list.txt## You can also check if a number is prime using
```bash
gcc ./checkPrimes.c -o checkPrimes./checkPrimes
``````
user@user$ time ./checkPrimes
Enter a number: 1779999803
1779999803 is a prime number.real 0m0.945s
user 0m0.001s
sys 0m0.000s
user@user$
```## How each code works
### addToFile.c
This code is responsible for adding a number to the primes.txt file.### checkMultiPrimes.c
This code is responsible for checking if a interval of numbers is prime. And if it is, print it on the screen.### checkPrimes.c
This code is responsible for checking if a number is prime. And if it is, print it on the screen.### createFile.c
This code is responsible for creating the primes.txt file. It will erase the file if it already exists.### createFileWithLimit.c
This code is responsible for creating the primes.txt file. It will erase the file if it already exists. It will also create a file with a limit of numbers.
Example: if you want to create a file with the first 1000 prime numbers, you can use this code.### checkPrimesWithThreads.c
This code is responsible for generating and printing prime numbers on the screen.### genAndPrint.c
This code is responsible for generating and printing prime numbers on the screen.