Prime Line Cover — OEIS A373813

5 min read Original article ↗

C++ Solver — primecover1024

Download and compile the exact solver that certified f(1024) = 143 as a new world record. This page runs a faithful JavaScript translation — fast enough to explore, not to certify.

This solver · N = 861

22 min

purpose-built exact solver · c4d-highcpu-8

Prior solver · N = 861

282 hrs

Mixed-Integer Programming (MIP) solver

f(1024) = 143

World record

< 40 hrs

complete N = 1–1024 sweep

Variants

primecover1024.cpp Primary primecover1024_line_coordinates.cpp

primecover1024_line_coordinates.cpp is the same exact solver — it additionally writes out the coordinates of every line in the optimal cover and the prime points each line passes through, enabling full reproducibility and visualisation.

Results

Quick Start — Run the C++ Solver

1

Get WSL (Windows Subsystem for Linux)

Open PowerShell as Administrator — right-click the Start button → Terminal (Admin) — and run:

Restart when prompted, then open the Ubuntu app from the Start menu to complete first-time setup.

2

Install GCC 14

The solver uses C++23 features that only GCC 14 and newer support. Ubuntu doesn't ship it by default — paste all three commands at once and they'll run in sequence:

Ubuntu (WSL)

sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt update
sudo apt install g++-14 -y

3

Copy, compile, and run

Download primecover1024.cpp and save it somewhere on your PC — Downloads or Desktop works. Click the edit button (✎) below and paste the full path to the file. The command updates instantly:

Ubuntu (WSL)

cp /mnt/c/path/to/primecover1024.cpp ~/solver.cpp && \
g++-14 -std=c++23 -O3 -march=native -pthread -fno-exceptions -fno-rtti \
  solver.cpp -o solver && \
./solver

Paste your file path

Works with Windows paths (C:\…) and WSL paths (/mnt/c/…)

Output begins printing after ~15 seconds of compilation.

1

Open a terminal

Press Ctrl+Alt+T or launch a terminal from your application menu. No extra layer needed — you're running Linux natively.

2

Install GCC 14

The solver requires C++23 features available only in GCC 14+. Install it for your distribution:

Ubuntu / Debian

sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt update
sudo apt install g++-14 -y

Arch / Manjaro

sudo pacman -S gcc

Fedora / RHEL

sudo dnf install gcc-c++ -y

3

Copy, compile, and run

Download primecover1024.cpp and save it somewhere in your home directory. Click the edit button (✎) below, paste the full file path, and the command updates instantly:

bash

cp /home/username/path/to/primecover1024.cpp ~/solver.cpp && \
g++-14 -std=c++23 -O3 -march=native -pthread -fno-exceptions -fno-rtti \
  solver.cpp -o solver && \
./solver

Paste your file path

Paste an absolute path (/home/…) or ~/…

bash

cp /home/username/path/to/primecover1024.cpp ~/solver.cpp && \
g++ -std=c++23 -O3 -march=native -pthread -fno-exceptions -fno-rtti \
  solver.cpp -o solver && \
./solver

Paste your file path

Paste an absolute path (/home/…) or ~/…

On Arch the binary is g++ (not g++-14), which is GCC 14 on a current Arch install.

bash

cp /home/username/path/to/primecover1024.cpp ~/solver.cpp && \
g++ -std=c++23 -O3 -march=native -pthread -fno-exceptions -fno-rtti \
  solver.cpp -o solver && \
./solver

Paste your file path

Paste an absolute path (/home/…) or ~/…

On Fedora 40+ the binary is g++ (not g++-14), which is GCC 14 when installed via gcc-c++.

Output begins printing after ~15 seconds of compilation.

1

Install Homebrew

Open Terminal (press ⌘ Space, type "Terminal", press Enter) and run:

Terminal

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

2

Install GCC 14

Apple Clang doesn't support all C++23 features used by the solver. GCC 14 via Homebrew is required:

Terminal

brew install gcc@14

Homebrew installs g++-14 into its bin directory and adds it to your PATH automatically.

3

Copy, compile, and run

Download primecover1024.cpp and save it in your home folder — Downloads works perfectly. Click the edit button (✎) below, paste the full file path, and the command updates instantly:

Terminal

cp /Users/username/path/to/primecover1024.cpp ~/solver.cpp && \
g++-14 -std=c++23 -O3 -march=native -pthread -fno-exceptions -fno-rtti \
  solver.cpp -o solver && \
./solver

Paste your file path

Paste an absolute path (/Users/…) or ~/…

Output begins printing after ~15 seconds of compilation.

This is the setup used to set the N = 1024 world record — a c4d-highcpu-8 instance (8 vCPUs, 15 GB RAM, AMD Turin) on Google Cloud's free trial. It reached the previous record boundary at N = 861 in just 22 minutes, against the prior certified record of 282 hours via MIP.

1

Install GCC 14

GCC 14 isn't in the default Debian repos — this pulls it from trixie. Connect via SSH first: Compute Engine → VM Instances → SSH. Paste all five commands at once:

SSH

echo "deb https://deb.debian.org/debian trixie main" | sudo tee /etc/apt/sources.list.d/trixie.list
printf "Package: *\nPin: release n=trixie\nPin-Priority: 100\n" | sudo tee /etc/apt/preferences.d/trixie
sudo apt update
sudo apt install -t trixie libc-bin -y
sudo dpkg --configure -a
sudo apt install -t trixie g++-14 -y

2

Upload and compile

Upload via the cloud icon (top-right of the SSH window) → Upload File → select primecover1024_line_coordinates.cpp. Then compile:

SSH

g++-14 -std=c++23 -O3 -march=znver5 -pthread -fno-exceptions -fno-rtti primecover1024_line_coordinates.cpp -o solver

Uses znver5 (AMD Turin), not native.

3

Launch

Run the solver fully detached — closing the browser tab or shutting down your PC won't interrupt it:

SSH

nohup stdbuf -oL ./solver > output.log 2>/dev/null &

4

Monitor

Four commands for checking progress. To download results use the cloud icon → Download File → output.log.

SSH

pgrep -a solver                                    # confirm it is running

SSH

tail -n 20 output.log                              # check recent output

SSH

tail -f output.log                                 # watch live (Ctrl+C to stop watching)

SSH

grep "Stats:" output.log | awk '{print $2, $4}'    # N and line count over time