A fast search and Lean 4 formalization for numbers whose digits are all 0 or 1 in several bases at once.
-
OEIS A258107:
$a(n)$ is the smallest number$> 1$ whose representation in every base$2 \dots n$ uses only the digits0and1. Known terms:2, 3, 4, 82000.$a(6)$ is unknown and conjectured not to exist. -
OEIS A146025: numbers that are all-0/1 in bases
2, 3, 4, 5. Known terms:0, 1, 82000. Any$a(6)$ would also be a term here.
The scanners do not expect to find new terms; they raise the lower bound below which no further term exists.
The leading digits of
Fix the top base
Work per length is
Each stage only rejects a length when padded intervals are disjoint. Survivors move to the next, more expensive stage.
| Stage | What it does | Arithmetic |
|---|---|---|
| 1. Arcs |
|
64-bit add and compare |
| 2. Bitmaps | Per-base table of phases compatible with base |
table lookup |
3. ddfs
|
Joint refinement of all bases down to interval width 2e-12
|
IEEE 754 doubles |
4. mdfs
|
Joint refinement down to width |
192-bit fixed point |
5. verify.py
|
Exact search for |
Python integers |
For top base 6, stages 1 and 2 reject ~99.95% of lengths. The GPU front-ends (gpuscan.m for Metal, gpuscan_cl.c for OpenCL) run stages 1–2 on the GPU and stream survivors to the CPU for stages 3–5 in parallel.
a258107/
scan.c CPU scanner (all four in-process stages, threading, checkpointing)
gpuscan.m Metal GPU front-end (stages 1–2 on GPU, stages 3–5 on CPU)
gpuscan_cl.c OpenCL GPU front-end (for non-Apple GPUs)
verify.py Rigorous integer resolver for a single length (stage 5)
gen_consts.py Generates consts.h (256-bit logarithm constants)
consts.h Pre-generated constants (checked in)
test.py Correctness tests against brute force and exact resolution
Makefile Build targets for CPU, Metal, OpenCL, and tests
proof/
NRB/ Lean 4 formalization (no dependencies beyond core Lean 4)
gen_ranges.py Generates parallel range-checking modules for NRB.Bound
not_really_binary.typ / .pdf
Writeup of what is proved, what is computed, and what remains open
Requires a C compiler with __int128 (clang or gcc on a 64-bit target) and python3.
cd a258107
make test # builds scan4, scan5, scan6 and runs test.py (~10 s)
./scan6 # CPU scan for a(6); runs until stopped
./scan5 # CPU scan for bases 2..5TOPBASE=4 (scan4) exists only for testing, since bases 3 and 4 have many common solutions.
cd a258107
make gpu # macOS (Apple Silicon / Metal) -> ./gpuscan
./gpuscan --batches 1 --no-state --check # verify GPU matches CPU on first batch
./gpuscan # runs until stopped
make opencl # Linux / non-Apple GPUs (OpenCL) -> ./gpuscan_cl| Option | Meaning |
|---|---|
--start L |
First length to scan (default: resume from state file, else 1) |
--end L |
Stop before this length (default and maximum: |
--threads T |
Worker threads (default 8) |
--no-state |
Do not read or write the state file |
--quiet |
Suppress progress lines |
--dump-s L |
Print the 192-bit scale factors for length |
Progress is written to state_b<B>.txt (or state_gpu_b6.txt / state_cl_b6.txt) every few seconds, and a stopped run resumes from it. Ctrl-C stops cleanly after the current batch.
Lengths that survive stage 4 are passed to verify.py and logged to candidates_*.log. Anything not proved dead is printed as a line starting with ***. With scan5 this happens once, at 82000.
Measured on an Apple Silicon laptop (November 2026):
| Scan | Lengths covered | No new term below about | Throughput |
|---|---|---|---|
| Top base 6 (Metal GPU + CPU) |
|
||
| Top base 6 (CPU, 8 cores) | — | — |
|
| Top base 5 (CPU, 8 cores) |
|
For comparison, the OEIS A146025 page records a 2015 search of bases 2..5 to about 11 million decimal digits.
proof/ is a standalone Lake project with no dependencies beyond core Lean 4. It formalizes the same interval criterion in natural-number arithmetic, proves the checker sound, and runs it.
| Theorem | Statement |
|---|---|
ok_iff_dec |
A number has only 0/1 digits in base |
a5 |
|
a6_gt_big |
|
blocks_sound |
Soundness of the magnitude sweep |
a6_bound |
cd proof
lake build NRB # verify the core theorems (~seconds)
lake build NRB.Bound # verify the full bound (~16 minutes on 8 cores)
python3 gen_ranges.py 32 # extend to more ranges, then rebuildThe final finite evaluations use native_decide, which trusts the Lean compiler. The Lean checker takes about
What has been checked:
-
verify.pyin exact mode matches brute-force enumeration for small$L$ with top base 4, 5, and 6. - The CPU scanner's final verdicts match the exact resolver for every
$L < 400$ . With top base 4 it flags exactly the 210 lengths that contain a solution. - The GPU scanner's
--checkmode confirms exact agreement with the CPU scanner's stage-1 and stage-2 survivor counts on the same batch. - The scale factors computed in C agree with an independent Python integer computation to about 185 bits.
What has not:
- Stages 1–3 of the C/GPU scanners rely on the platform
expbeing accurate to a few ulp and on hand-chosen padding margins. There is no written error analysis, so the C/GPU bounds are careful engineering rather than a formal proof. - The padding analysis assumes
$L < 2^{56}$ , which is where the scan stops.