From b668ce7f8a52d08c447a361698f7b440c94dcae2 Mon Sep 17 00:00:00 2001 From: ilikecats Date: Fri, 5 Jul 2024 16:49:52 -0700 Subject: [PATCH] Testing testing one two 3 --- .gitignore | 2 ++ Makefile | 3 +++ README.md | 2 ++ main.cpp | 28 ++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 README.md create mode 100644 main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..33d762a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Ignore emacs backups +*~ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b6af122 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +default: + mkdir bin + c++ main.cpp -o bin/primes diff --git a/README.md b/README.md new file mode 100644 index 0000000..36d3f7c --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# test git repo +## teh code is to generate primes \ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..bd697e7 --- /dev/null +++ b/main.cpp @@ -0,0 +1,28 @@ + +// Generate primes using the sieve of eratosthenes +#include +#include + +int main() { + // TODO: make it work with GMP (https://gmplib.org/) + unsigned int nextnumber { 3 }; + bool notprime; + std::vector primes; + primes.push_back(2); // Initial prime + std::cout << "2\n"; + + while (true) { + notprime = false; + for (unsigned int i=0;i