82000 — The Search Is On

I introduced the sequence 2, 3, 4, 82000, … in an earlier post. To recap: the n-th term is the smallest number > 1 whose representation in all bases up to n uses only the digits 0 and 1.

Nobody has found the next term. I wrote a C++ program to search for it. The code is on GitHub and uses the GNU Multiple Precision Arithmetic Library, since the candidates quickly grow to millions of digits.

The algorithm

The core idea: take a guess and check whether it satisfies all bases from the target base down to 3. (Base-2 is always satisfied by definition.)

As soon as a base fails — i.e., the number’s representation in that base contains a digit other than 0 or 1 — we don’t check further bases. Instead, we jump directly to the next number that would satisfy that base. This skip is roughly proportional to the size of the number, which keeps the search tractable even for huge candidates.

Example: verifying 82000

Starting from 10 (the first candidate past 4), the algorithm visits only 16 numbers before finding 82000:

DecimalBase-5Base-4Base-3
102022101
25100121221
6422410002101
1251000133111122
256201110000100111
6251000021301212011
1024130441000001101221
312510000030031111021202
4096112341100000012121201
1562510000003310021210102201
16384101101410000000211110211
16400101110010000100211111102
196831112213103032031000000000
781251000000010301023110222011112
819201011014011000000011011101002
820001011100011000110011011111001

Bold entries are the failing base that causes the jump. The algorithm checks the largest base first, aborting as soon as one fails.

Current status

As of September 7, 2015, the code has been running for a week on my desktop with 20 threads and has reached candidates with almost 14 million digits — compared to 82000’s 5 digits. Still no hit.

The next post covers the performance analysis and threading details.