Explore plotting prime numbers in polar coordinates. Inspired by: Why do prime numbers make these spirals? and concept of primes as figure or ground introduced in Godel, Escher, and Bach.
Uses plotting library matplotplusplus.
- CMake version 3.20 or higher
- C++ compiler that supports C++20
- clang-format for formatting files
Example using clang++ compiler. Replace clang++
with g++
if using gcc.
mkdir build
cmake -S .. -B . -DCMAKE_CXX_COMPILER=clang++ -DWARNINGS=ON -DWARNINGS_AS_ERRORS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build . -j12
Needs matplotplusplus library for build. The latest master branch of matplotplusplus is downloaded and built as part of cmake project.
Install gnuplot. For Fedora:
sudo dnf install -y gnuplot
clang-format ../src/*.hpp -i
clang-format ../src/*.cpp -i
Polar plot of points (x,x) of all natural numbers x between 1-10000:
Polar plot of points (x,x) of all prime numbers x between 1-10000: