# Rational and irrational infinite integers

Epistemic status: a fine line between genius and madness

*

Let's start with the observation that it is much easier to use digits before the decimal point than the digits after it. A six years old child could calculate e.g. 11 + 2, but calculating reliably 0.11 + 0.2 will take a few more years of education.

From this perspective, it is quite ironic that we typically use numbers that only have a few digits before the decimal point, and many, sometimes *infinitely many* digits after the decimal point, such as 1/3 = 0.333333333... = $0.\overline{3}$.

*Obviously*, it would be better the other way round.

*

Technically, we already have infinitely many digits *in front* of every number. But they are all zeroes; and by convention, we do not write them. Writing a zero or multiple zeroes in front of a number does not change its value; the number 007 mathematically means 7. Therefore, technically, we could write the number 7 with infinitely many digits in front of it, like this: $\overline{0}7$.

But it seems like a waste of space to only ever fill those infinitely many pre-decimal places with zeroes. What about using some other digit instead?

Consider the number $\overline{9}$, which consists of infinitely many nines. Written in full, it would be like this: $\overline{9}$ = ...999999999.

The value of this number is -1.

How can we know that? Simply, just calculate ...999999999 + 1 = ...000000000, which is zero. (Zero with an arbitrary number of zeroes in front of it is zero: 0 = 00 = 000 = $\overline{0}$.)

Similarly, ...999999998 = $\overline{9}8$ is -2, because $\overline{9}8 + 2 = \overline{0}$. Also $\overline{9}7 = -3$, $\overline{9}6 = -4$, and so on.

Seems like we have invented a new syntax for negative numbers. Instead of writing a minus symbol in front of a number, just let the digits underflow. If an odometer in your car showed only nines, you would know what happens if you go the extra mile.

*

What if we fill the infinite pre-decimal places with digits *other* than zeroes and nines? For example, how much is $\overline{1}$?

I believe this number is -1/9.

We can easily verify it by multiplying the number by 9 and adding 1.$\overline{1} × 9 + 1 = \overline{9} + 1 = \overline{0}$.

Okay, this seems strange. How did a fraction smaller than one suddenly become an *infinite integer*? But as you can clearly see, it did. Remember, our goal was to move the infinite digits behind the decimal point to the front of it. And so far, we are succeeding!

*

We can similarly get other negative fractions by dividing $-1 = \overline{9}$ by the denominator, and multiplying the result by the numerator. For example, $-1/3 = \overline{3}$, $-2/3 = \overline{6}$, $-1/7 = \overline{142857}$. Check it, $\overline{142857} × 7 + 1 = \overline{9} + 1 = 0$.

To obtain a positive fraction, we can subtract the negative fraction from zero. For example, $1/9 = 0 - (-1/9) = 0 - \overline{1} = \overline{8}9$. Check it, $\overline{8}9 × 9 = \overline{0}1$. Seems correct.

But there is still problem with fractions like 1/2 or 1/5. There is no integer, not even infinite one, such that if we multiplied it by 2 or by 5, the last digit of the result would be 1. (We can easily check it, because the last digit of the result only depends on the last digit of the original number.) Therefore, some decimal places seem inevitable: 1/2 remains 0.5, and 1/5 remains 0.2. We have not eliminated *all* decimal places from the fractions, only the *infinite* sequences thereof.

Using the new syntax, any fraction will have *at most finite* number of decimal places. To see why it is so, extract the powers of 2 and 5 from the denominator, like this: $\frac{n}{d} = \frac{n}{2^i 5^j k}$, then calculate the infinite integer $\frac{n}{k}$ and divide it by $2^i$ and $5^j$. The number of decimal places of the result will be max(i, j). That kinda sucks, but whatever.

By the way, $-1/2 = \overline{9}.5$, and $-1/5 = \overline{9}.8$. I assume it is obvious why.

(Having an infinite number of digits *both* before and after the decimal point would lead to *ambiguity*. For example, 1/3 could be expressed as both $\overline{6}7$ and $0.\overline{3}$.)

*

Okay, so now we can convert an arbitrary fraction to a periodic number with finite decimal part. Can we also do it the other way round? For example, what fraction is expressed by a number $\overline{123}45$? (Notice that "123" is the periodic part, "45" is not.)

$\overline{123}45 = \overline{123}12 + 33 = \overline{312} + 33 = \overline{999} × \frac{312}{999} + 33 = 33 - \frac{312}{999} = \frac{32655}{999} = \frac{10885}{333}$

*

But what about the non-periodic infinite integers? (By the way, now we have *uncountably* many integers, how cool is that?) Do they correspond to the irrational numbers?

Let's try to calculate $\sqrt{2}$. The result cannot have decimal places, because infinite decimal places are forbidden, and if you have a number with *finite* decimal places, its square only has *more* decimal places. So we need to find an infinite integer such that its square is 2.

However, there is no such integer, not even an infinite one. The last digit of a square only depends on the last digit of the original number, but if the original number ends with 0, its square ends with 0; if it ends with 1 or 9, its square ends with 1; if it ends with 2 or 8, its square ends with 4; if it ends with 3 or 7, its square ends with 9; if it ends with 4 or 6, its square ends with 6; and if it ends with 5, its square ends with 5. Therefore, in our new system, there is *no such thing* as $\sqrt{2}$. (Or $\sqrt{3}$, or many others.)

The problem is even easier to see with $\sqrt{1/2}$. Would it be an infinite integer, or a decimal number? A square of an integer is an integer. A square of a decimal number with finite decimal places has twice as many decimal places. Neither of those can equal to 0.5.

(However, there seem to be more values of $\sqrt{1}$ than one might expect. In addition to the obvious $\overline{0}1$ and $\overline{9}$, there also seem to be non-periodic values such as ...4218751; but maybe I just made a mistake somewhere. EDIT: Actually, see the note at the end.)

*

Apparently in this new system, we have lost the traditional irrational numbers (some of them? all of them? I have no idea), and gained some new irrational integers (non-periodic infinite integers) which correspond to... uhm, *something else*, I guess. Spooky.

I admit I am out of my depth here. I tried to follow this rabbit hole as far as I could, and this is exactly how far I got. I hope you enjoyed the ride.

*

According to Wikipedia, you should not do this stuff in base 10, but should use a *prime* base, such as binary. (The proper term for these infinite integers is [p-adic numbers](https://en.wikipedia.org/wiki/P-adic_number).) It is not obvious to me much how much this would actually help. I was able to map rational numbers to periodic numbers in base 10, too. And the calculation of $\sqrt{2}$ would also fail in binary, for the same reason. What is then the supposed advantage?

(Hat tip to 3Blue1Brown for [*What does it feel like to invent math?*](https://www.youtube.com/watch?v=XFDM1ip5HdU))

*

EDIT: I was curious about the mysterious new values of $\sqrt{1}$, and although my math skills are not sufficient to do this properly, at least I wrote a program to check all combinations of last 100 digits in bases from 2 to 100, to find ones ending with ...0001 when squared.

The new values of $\sqrt{1}$ seem to appear only when the base is not a prime number (nor a power of a prime), which would kinda explain the recommendation in Wikipedia.

More specifically, the number of values of $\sqrt{1}$ seems to depend on how many *different primes* divide the base, and it goes (*including* the traditional values of 1 and $-1=\overline{9}$) like this: 2, 4, 8, 16, 32..., which seems suspiciously like the powers of 2.

(My intuition tells me that if you choose a *subset* of the primes dividing the base, you can somehow obtain from that a value of $\sqrt{1}$ in a way that maps "none" to 1, and "all" to -1, and the remaining combinations to the irrational integers. No more specific ideas.)

The new values of $\sqrt{1}$ follow some rules that are obvious in hindsight. They come in pairs: if *x* is a solution, then so is *-x*, because $x^2 = (-x)^2$. If you multiply *x* by *-x*, you get -1, because $x(-x) = -x^2$. Multiplying two solutions that are *not* the opposite of each other results in yet another solution, because if $x^2 = 1$ and $y^2 = 1$, then also $(xy)^2 = 1$.

The two new solutions in base 10 are like ...480163574218751 and ...519836425781249, which does not remind me of anything. If you want more than two new solutions, you need to try at least base 30 (=2×3×5) for six new solutions, or base 210 for fourteen.