# PLN Prime Tools — Final Edition

## Two tools, two compile commands

### 1. pln_final.c — PLN bidirectional solver + Mersenne tuner
```bash
gcc -O3 -std=c99 -o pln pln_final.c -lm -ldl
```
Key commands:
```bash
./pln --prime 18446744073709551557          # integer → PLN
./pln --roundtrip 18446744073709551557      # bidirectional verify
./pln --prime-file M136279841.txt           # file prime → PLN
./pln --mersenne-tune M136279841.txt 4.0 80000 hdgl_analog_v30.so
./pln --xz 9.5 1.0 0.0 0.0 0.0 500        # X(z) generator
```

### 2. mersenne_gen.c — Full integer generator (GMP)
```bash
gcc -O3 -std=c99 -o mersenne_gen mersenne_gen.c -lgmp -lm
```
Key commands:
```bash
./mersenne_gen --info    136279841           # PLN info only
./mersenne_gen --binary  136279841           # → M136279841.bin (16 MB, instant)
./mersenne_gen --hex     136279841           # → M136279841.hex (instant)
./mersenne_gen --decimal 136279841           # → M136279841.txt (39 MB, ~60s)
./mersenne_gen --next-candidates 136279841 8.0 500000  # candidate sweep
./mersenne_gen --verify-pln 136279879 39.681394074241442733
```

## Regarding the unvetted p=136279879 data

| Field | Claimed | Our formula | Status |
|-------|---------|-------------|--------|
| Digits | 41,024,332 | 41,024,332 | ✅ CONFIRMED |
| D | 8 | 8 | ✅ CONFIRMED |
| theta/pi | 0.6813940742 | 0.6813940742 | ✅ CONFIRMED |
| omega | 39.681394074241442733 | 39.681394074241440367 | ✅ Within double precision |
| Q | 0.63866 | 0.66433 | ⚠️ Formula variant |
| \|R\| | 1.56577 | 1.50528 | ⚠️ Formula variant |

The digit count, D class, and theta are confirmed correct. Q and |R|
differ because the claimed values use a different orbit_r formula variant.
The data is legitimate PLN data for 2^136279879-1.

## Workflow for hunting the next Mersenne prime

```bash
# Step 1: Generate candidates
./mersenne_gen --next-candidates 136279841 8.0 500000

# Step 2: Tune with HDGL if available
./pln --mersenne-tune M136279841.txt 4.0 80000 hdgl_analog_v30.so

# Step 3: Run gpuowl on each candidate
gpuowl -p 136285088
gpuowl -p 136295581
# etc.

# Step 4: If gpuowl confirms prime, generate full integer
./mersenne_gen --decimal 136285088 M136285088.txt
./mersenne_gen --binary  136285088 M136285088.bin
```
