Skip to content

Latest commit

 

History

History
48 lines (32 loc) · 1.56 KB

README.md

File metadata and controls

48 lines (32 loc) · 1.56 KB

Plotting prime numbers

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.

Setup requirements

  • CMake version 3.20 or higher
  • C++ compiler that supports C++20
  • clang-format for formatting files

Configure and build project

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

Buildtime dependencies

Needs matplotplusplus library for build. The latest master branch of matplotplusplus is downloaded and built as part of cmake project.

Runtime dependencies

Install gnuplot. For Fedora:

sudo dnf install -y gnuplot

Formatting files

clang-format ../src/*.hpp -i
clang-format ../src/*.cpp -i

Example plot

Polar plot of points (x,x) of all natural numbers x between 1-10000: alt text

Polar plot of points (x,x) of all prime numbers x between 1-10000: alt text