A Trott constant is a number whose continued fraction representation (simple or not) is the same as the digits of its radix representation. For instance, in base 10, . This Corner implements a search method for such numbers and lists its results. The best number we found has more than 400 digits in common between its nonsimple, zero-free continued fraction representation and its radix representation.

### Introduction

A few years ago I dreamed of a number whose continued fraction digits and decimal digits were identical. Once awake, I could not remember the digits of the number. So I tried to re-create the number (if such a number even exists) with *Mathematica*. I found that such a number (and even more than one) seems to exist.

In this Corner, we will implement a search program that looks for such numbers. All of the following will be purely experimental; I have not been able to prove existence, uniqueness, or any properties of these numbers.

### Existing Sequences

The On-Line Encyclopedia of Integer Sequences currently (January 2006) lists the following Trott constants:

www.research.att.com/projects/OEIS?Anum=A039662

0, 1, 0, 8, 4, 1, 0, 1, 5, 1, 2, 2, 3, 1, 1, 1, 3, 6, 1, 5, 1, 1, 2, 9, 0, …

Meaning the following holds:

www.research.att.com/projects/OEIS?Anum=A091694

0, 2, 7, 3, 9, 4, 4, 1, 9, 5, 7, 3, 9, 2, 7, 1, 6, 1, 7, 1, 7, 1, 4, 5, 9, …

So the following holds:

www.research.att.com/projects/OEIS?Anum=A113307

0, 4, 8, 2, 6, 7, 7, 2, 8, 1, 9, 3, 9, 1, 8, 1, 5, 9, 9, 4, 9, …

Section 1.2.3 of *The Mathematica GuideBook for Programming* uses a version of the following one-liner to find such a number.

Here is a continued fraction made from this sequence of integers.

Here is the corresponding fraction and its 100-digit decimal approximation.

The first 100 digits of the continued fraction and the decimal expansion are identical.

We will implement an expanded version of the program that calculated `heldCF` and use it to find various numbers (which *MathWorld*’s creator Eric Weisstein calls “Trott’s Constants” [1]) whose simple or nonsimple continued fraction approximation agrees with their base radix representation up to a few hundred digits.

### Some Formatting Functions

We start by defining functions to format continued fractions. The function `formatNonSimpleContinuedFraction` formats a list of integers as a nonsimple continued fraction. To avoid autoevaluation of the result to a single rational number, we use `HoldForm`.

Here is an example.

We use `formatNonSimpleContinuedFraction` to define a similar function for simple continued fractions.

Here again is an example.

For a slightly less readable, but more space-conserving way to write such continued fractions, we define two more functions.

### Difference Between Continued Fractions and Radix Forms

The next two functions construct a rational number (an integer in degenerate cases) from the lists of digits.

To measure the quality of a Trott constant, we compare the value of the radix form and the continued fraction. The function `radixCFDifference` calculates the difference.

Here again are two examples.

The function `numberOfCoincidingDigits` calculates the number of coinciding digits in the continued fraction and base decimal representation (including the leading zero).

Here are our two examples.

Here we analyze the three sequences from the integer database.

We define another function for later use. Given a sequence, the function `shortenedSequence` shortens it to the minimal length that exhibits the maximal number of coinciding digits.

Here a continuation of the sequence (which does not improve) is shortened to its optimal length.

### Investigating Small Sequences

Now let us have a preliminary look at the differences between the radix and continued fraction representations. The function `allNDigitSequences` returns a list of all -digit base sequences. We will always assume that the first digit is zero.

The function `sequencesAnds` adds the difference between the radix and continued fraction representations to the sequences.

Here we show the differences for the simple and nonsimple continued fractions for sequences of length 2 to 5. We color the differences according to the original sequence length.

The second graphic shows the partially periodic, fractal-like behavior of the differences. For these short sequences, we can obtain a few coinciding digits for 0.1… and 0.3… for simple continued fractions. The next graphics zoom into these areas.

Here we show base 2 using longer sequences, all sequences up to length 12. Qualitatively we obtain similar graphics.

### Search Function for the Constants

In this section we implement the main search function. Some of the searches we carry out run for many hours or even days. So, to see some progress, we define a function, `printProgressCell`, that prints the current state of the search.

The function `SearchForTrottConstants` searches for a Trott constant in base *base* starting with the initial sequences *initialSequences*. Options for this function are: `RecordSearchHistory`, which determines if the maximal number of coinciding digits as a function of the iteration number should be recorded through the function `searchHistoryData`; `AllowZeroDigits`, which determines if 0 is allowed as a digit; `PrintSearchProgress`, which determines if cells showing the search progress should be printed; `MaxIterations`, which determines the maximal number of iterations; and `MinDigitsWanted`, which determines the minimum number of digits that agree that are wanted.

Here is the search function `SearchForTrottConstants`. The method is quite simple. Starting with the pool of given initial sequences *initialSequences*, we repeatedly add base digits, evaluate their quality (which means the number of coinciding digits in the two representations), and keep the best *poolSize* sequences in the pool. We repeat this process until either the best sequence no longer shows improvements or the specified number of digits that agree has been achieved. The comments in the code explain the individual steps.

This example shows `SearchForTrottConstants` during the search.

### Carrying Out and Monitoring Searches

A practical, relevant question for carrying out searches concerns the dependence on the pool size. This simple example shows a trend that is also visible in much larger pool sizes—a high sensitivity to the actual pool size. This sensitivity occurs because a sequence that at iteration shows a relatively poor performance might show a much better performance at iteration . When the pool size is not large enough, this sequence might be discarded too early. In general, the larger the pool size the better the results. But the larger the pool size, the longer the search will run and with pool sizes too large, we might run out of memory.

For nonsimple continued fractions we see a similar, non-monotonic dependence on the pool size.

Here a larger search is carried out. We do not restrict the possible initial sequences and use a pool size of 1000.

We achieved about 60 coinciding digits in about 15 minutes. The next three graphics show the number of coinciding digits of the optimal sequence, the number of different groups of sequences with different initial six digits, and the position of the first different digit across the pool of sequences as a function of the iteration number. We see that on average we gain a constant number of digits per iteration as long as we gain digits. We also see how the numbers in the pool converge towards a single number.

And here is the equivalent of the last calculation for nonsimple continued fractions. Again we use a pool size of 1000. This time, we obtain more than 100 identical digits. And again we see on average a linear increase in the digits gained as well as convergence on one final number (after about 40 iterations).

### Some Constants That Were Found

What about other bases? Here are some results from running `SearchForTrottConstants` with various parameters. Additional constants can be found in the Additional Material section.

### Digit Gains with Seeded Sequences

Here are the results for the number of achieved coinciding digits from running for all 90 possible combinations of and . No obvious pattern for optimal starting digits is visible.

These are the results for the number of achieved coinciding digits from for all 9000 possible combinations of , , , and . The pattern suggests that a larger number of agreeing digits is achieved periodically.

### Why Searches Are Difficult

Lochs’ theorem [2] states that to represent a decimal number with digits, we need about simple continued fraction terms. This means that when adding digits to our lists, the continued fraction digits and the radix digits get slowly out of sync. To ensure that the digits agree with each other, we need a pool size that becomes progressively larger.

Lochs’ theorem holds in its classic form only for simple continued fractions. But experience shows that nonsimple continued fractions behave similarly. Let us analyze the best Trott constant found with more than 400 coinciding digits.

On average we obtain about 0.7 decimal digits per continued fraction digit.

The following graphics show the digit gain and the difference of the digit gain and its linear part.

The absolute difference shows similar behavior, though different in detail.

### Summary

In this Corner, we presented a *Mathematica* function to search for Trott constants. The numerical results indicate that such constants exist. But no proof of existence is available. Do such constants exist in any integer base? If such constants exist, how many are there? A finite number or an infinite number? The preliminary numerical results presented here do not allow conjectures. We hope extended numerical searches will shed some light on this subject.

### References

[1] | Eric W. Weisstein, “Trott’s Constant” from MathWorld—A Wolfram Web Resource. mathworld.wolfram.com/TrottsConstant.html. |

[2] | Eric W. Weisstein, “Lochs’ Theorem” from MathWorld—A Wolfram Web Resource. mathworld.wolfram.com/LochsTheorem.html. |

M. Trott, “Finding Trott Constants,” The Mathematica Journal, 2012. dx.doi.org/10.3888/tmj.10.2-2. |

### Additional Material

AdditionalConstants.nb

Available at www.mathematica-journal.com/data/uploads/2012/05/AdditionalConstants.nb.

### About the Author

**Michael Trott**

Senior Member, Technical Staff

*Wolfram Research, Inc.
*

*mtrott@wolfram.com*