Rational and irrational infinite integers

post by Viliam · 2022-03-23T23:12:20.135Z · LW · GW · 28 comments

Contents

28 comments

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... = .

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: .

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 , which consists of infinitely many nines. Written in full, it would be like this:  = ...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 = .)

Similarly, ...999999998 =  is -2, because . Also , 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 ?

I believe this number is -1/9.

We can easily verify it by multiplying the number by 9 and adding 1..

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  by the denominator, and multiplying the result by the numerator. For example, . Check it, .

To obtain a positive fraction, we can subtract the negative fraction from zero. For example, . Check it, . 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: , then calculate the infinite integer  and divide it by  and . The number of decimal places of the result will be max(i, j). That kinda sucks, but whatever.

By the way, , and . 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  and .)

*

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 ? (Notice that "123" is the periodic part, "45" is not.)

*

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 . 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 . (Or , or many others.)

The problem is even easier to see with . 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  than one might expect. In addition to the obvious  and , 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.) 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  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?)

*

EDIT: I was curious about the mysterious new values of , 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  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  seems to depend on how many different primes divide the base, and it goes (including the traditional values of 1 and ) 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  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  follow some rules that are obvious in hindsight. They come in pairs: if x is a solution, then so is -x, because . If you multiply x by -x, you get -1, because . Multiplying two solutions that are not the opposite of each other results in yet another solution, because if  and , then also .

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.

28 comments

Comments sorted by top scores.

comment by Adele Lopez (adele-lopez-1) · 2022-03-24T00:15:01.076Z · LW(p) · GW(p)

Awesome exploration, you managed to hit a deep and interesting subject!

BTW, it's perfectly legitimate to do 10-adic integers, or for any n (see here). The reason primes are preferred is because of this issue you discovered:

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.

T̶h̶a̶t̶ ̶d̶o̶e̶s̶n̶'̶t̶ ̶h̶a̶p̶p̶e̶n̶ ̶i̶f̶ ̶y̶o̶u̶ ̶u̶s̶e̶ ̶a̶ ̶p̶r̶i̶m̶e̶ ̶n̶u̶m̶b̶e̶r̶ ̶i̶n̶s̶t̶e̶a̶d̶,̶ ̶s̶o̶ ̶y̶o̶u̶ ̶g̶e̶t̶ ̶a̶l̶l̶ ̶"̶f̶r̶a̶c̶t̶i̶o̶n̶s̶"̶ ̶a̶s̶ ̶"̶i̶n̶t̶e̶g̶e̶r̶s̶"̶.̶ ̶ [ETA: This is wrong, see comment below.]

If you want things like , you'll need to do a limiting process (called the completion) just like you would to complete to get . The completion of -adic integers is called , and you need to use a -absolute value called the -adic valuation to do the Cauchy completion.

The thing I find most interesting is the fact that if you start with plain old , you can use any of these absolute values to complete it, and get . The only other way you can complete like this is by using the standard absolute value to get . This is Ostrowski's theorem. So there's a completion for every prime number, plus an extra one for . Number theorists will sometimes talk as if this extra completion came from a mysterious new prime number, called the "prime at infinity". This actually does work a lot like a prime number in lots of contexts, for example in the Galois theory of finite field extensions.

Replies from: gjm, Viliam, gjm
comment by gjm · 2022-03-24T01:01:32.921Z · LW(p) · GW(p)

It's maybe worth saying that while you can get  in, say, , (1) this isn't really "the same as you have in the reals -- I mean, it is a square root of 2, just as the corresponding thing in the reals is, but the structure it fits into isn't the same as that of the reals -- and (2) just as some square roots (those of negative numbers) don't exist in , so some square roots (but a different set) don't exist in any given . For instance, there is no square root of 2 in  or  or in , which is why I said  before.

(In , just as in , in some sense "about half" of integers have square roots.)

[EDITED to add:] Actually I see that Viliam already noticed that not everything has a square root in the p-adics. 

A couple more remarks. The things Viliam constructed are (aside from the base-10 versus base-p thing) the p-adic integers, generally written ; the full p-adic field  is what you get if you allow finitely many nonzero digits after the "decimal" point, just as when writing ordinary numbers we allow finitely many nonzero digits before the decimal point.

To get all the square roots (and much more), you can construct an "algebraic closure" of  just as you can for . But the story here isn't quite as nice as it is when you go from  to .

  • You get  from  by doing a "topological completion", and then  from  by doing an "algebraic closure", but then  is still topologically complete. Similarly, you get  from  by doing a topological completion (using a different topology), and then you can construct an algebraic closure of that ... but then the result isn't topologically complete any more.
  • There is a simple explicit construction to get from  to : you throw in a square root of -1 and then every other polynomial equation becomes solvable. (Which is the definition of being "algebraically closed".) That isn't the case for , whose algebraic closure is not a nice "finite extension" like that. If you extend  or  just enough to get a square root of 2, that doesn't automatically get you all the other square roots, or solutions to all the other polynomial equations that don't have 'em.
Replies from: Leo P., ege-erdil
comment by Leo P. · 2022-03-25T01:08:23.037Z · LW(p) · GW(p)

An other funny thing you can do with square roots: let's take  and let us look at the power series . This converges for , so that you can specialize in . Now, you can also do that inside , and the series converges to , ``the'' square root of . But in  this actually converges to 

comment by Ege Erdil (ege-erdil) · 2022-03-24T02:07:48.561Z · LW(p) · GW(p)

A further remark: confusingly, the algebraic closure of and its completion are actually isomorphic as fields (and both are also isomorphic to ), since they are both algebraically closed fields of characteristic zero and of cardinality of the continuum.

Replies from: gjm
comment by gjm · 2022-03-24T13:49:24.869Z · LW(p) · GW(p)

Yup. Very different topologically, though.

comment by Viliam · 2022-03-24T14:15:30.798Z · LW(p) · GW(p)

it's perfectly legitimate to do 10-adic integers, or for any n (see here).

Ah, the wonders of modern science! Whatever insane idea you get, pretty sure someone already published it decades ago. (Related: Contra Hoel On Aristocratic Tutoring at ACX)

That doesn't happen if you use a prime number instead, so you get all "fractions" as "integers".

What would be 1/2 in base 2, or 1/5 in base 5? I think that p-adic numbers also make an exception for fractions that contain the base in the denominator.

Number theorists will sometimes talk as if this extra completion came from a mysterious new prime number, called the "prime at infinity".

Not sure if this is related, but writing -1 as ...999 already feels kinda like "modulo infinity". And of course ω is a prime number; it's not like you can divide it by 2 or something. :D

(Don't mind me, I don't really understand most of this. What's in this article is exactly as far as I got.)

Replies from: adele-lopez-1, gjm
comment by Adele Lopez (adele-lopez-1) · 2022-03-25T01:39:39.270Z · LW(p) · GW(p)

What would be 1/2 in base 2, or 1/5 in base 5? I think that p-adic numbers also make an exception for fractions that contain the base in the denominator.

Ah yeah, what I said was wrong. I was thinking of the completion which is a field (i.e. allows for division by all non-zero members, among other things) iff is prime. The problem with 10-adics can be seen by checking that ...2222 * ...5555 = ...0000 = 0, so doing the completion has no hope of making it a field.

comment by gjm · 2022-03-24T18:09:33.991Z · LW(p) · GW(p)

There's no 1/2 in the 2-adic integers, but there's a 1/2 in the 2-adic numbers where you're allowed finitely many places after the decimal (binary) point. So although e.g. 1/3 = ...0101010101 with nothing right of the binary point, 1/2 = 0.1 with a single place to the right. So 5/6 = ...0101010101.1.

comment by gjm · 2022-03-24T00:32:33.129Z · LW(p) · GW(p)

Oh, please please tell me you're an algebraic number theorist actually called Adele.

Replies from: adele-lopez-1
comment by Adele Lopez (adele-lopez-1) · 2022-03-24T00:39:51.796Z · LW(p) · GW(p)

I'm a programmer, but my website uses (the ring of rational adeles) as the favicon :D

Replies from: gjm
comment by gjm · 2022-03-24T00:46:22.024Z · LW(p) · GW(p)

Heh. I thought actually being an algebraic number theorist was too much to ask for, but hope springs eternal :-).

comment by Slider · 2022-03-24T00:12:13.514Z · LW(p) · GW(p)

I don't really follow ...999999999 + 1 = ...000000000 . To me the carry must be dealt with and I would say that ...99999 + 1 results in 1000...000 which is greatly larger than ...0000.

I see surreals everywhere but engaging with this does tickle a confusino I had with them. In a sense  is like the unity of transfinite numbers but it is surrouded by , and  if you count up to  from 0 why you don't stop at the previous -1 ones? 9 has a number at digit 1, 90 has the 9 in the digit 2. With ...9999 all the finite number indexed digits are full of 9. When you add 1 to the thing and addition starts to carry it can't land on any finite index, yet it must go somewhere. So in the spirit of transfinite induction, the carry lands in the digit  with 1 leaving all the finite indexes 0. This would seem to be independent of the base used.

I am bit unsure on reading whether uncountable integers are supposed to start with periodic integers or only with non-periodic integers. Rational numbers have the same cardinality as integers so being able to express fractions doesn't get the party started yet.

Replies from: gjm, Viliam
comment by gjm · 2022-03-24T00:43:32.477Z · LW(p) · GW(p)

What Viliam is looking at here doesn't (I think) have much to do with surreal numbers.

I don't understand the question "why you don't stop at the previous -1 ones?". I think there may be a false assumption built into it. You don't "count up to  from 0", in the surreal numbers. You do do that, in some sense, in the ordinals, but there there isn't a .

Perhaps there might be a variant of p-adic numbers where you allow a digit for each ordinal position rather than each non-negative integer position. But that seems like it might be problematic because there are too many ordinals; for instance, in ZF set theory with the usual conventions there are no functions from the ordinals to {0,1,...,p-1} to be these numbers. (You could consider partial functions, with the convention that anything not specified thereby is zero. But then e.g. you no longer have a representation for -1.)

There are only countably many p-adic numbers with periodic digit sequence. There are uncountably many once you fill in the gaps and allow non-periodic sequences. (Just like with ordinary decimals.)

Replies from: Slider
comment by Slider · 2022-03-24T09:57:22.148Z · LW(p) · GW(p)

 has birthday  and  has a birthday of .

It might be a little informal in my head but I liken that you get the ordinary finite integers from a successor function and the finite integers get their birthdays by finite induction by being constructed from  the previous birthday. So each of that steps seem like "+1". Then when you do the first transfinite induction it feels like "+1" "real hard". And when you have calculations like  that can seem like it correspond to the operation of "+1, omega times"

comment by Viliam · 2022-03-24T14:35:59.870Z · LW(p) · GW(p)

As gjm said, this article assumes that there are only digits at integer-numbered positions, and whatever gets pushed to infinity position is effectively lost (because there is no such position). Having digits at surreal-integer-numbered positions seems also interesting, but it's not what I was trying to do.

I am bit unsure on reading whether uncountable integers are supposed to start with periodic integers or only with non-periodic integers.

Only with non-periodic, because... what you said. Otherwise, there is a finite periodic part (i.e. the sequence that gets repeated is finite), optionally followed by a finite part at the end (and optionally a finite decimal part), that is only countably many options.

Replies from: Slider
comment by Slider · 2022-03-24T14:47:19.629Z · LW(p) · GW(p)

I get that ...9999 + 1 = ...000 goes to an interesting direction and ...9999 + 1 = 100...000 goes to an interesting direction. And we can assume/axiom into those directions. But it can also be taken as a claim. One could explore what "2+2=5" implies but another natural reaction is also to be disinterested because one asssume things in opposition to that. So is there multiple ways to make formal or concretise the informal intuitions and does that say something interesting how addition works?

Replies from: Viliam
comment by Viliam · 2022-03-24T16:13:15.602Z · LW(p) · GW(p)

Some thought experiments have later some surprising use e.g. in physics. Other thought experiments don't. It is probably difficult to predict.

comment by Ricardo Meneghin (ricardo-meneghin-filho) · 2022-03-25T02:08:35.110Z · LW(p) · GW(p)

In computers, signed integers are actually represented quite similar to this, as two's complements, as a trick to reuse the exact same logical components to perform sums of both positive and negative numbers.

comment by AlexMennen · 2022-03-25T15:27:35.649Z · LW(p) · GW(p)

(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  in a way that maps "none" to 1, and "all" to -1, and the remaining combinations to the irrational integers. No more specific ideas.)

That is correct! In base  (for distinct primes ), an integer is determined by an integer in each of the bases , essentially by the Chinese remainder theorem. In other words, . In prime base, 1 and -1 are the only two square roots of 1. In arbitrary base, a number squares to 1 iff the number it reduces to in each prime factor of the base also squares to 1, and there's 2 options for each of these factors.

Replies from: Viliam
comment by Viliam · 2022-03-25T22:27:17.902Z · LW(p) · GW(p)

Sounds convincing (although maybe that's because you agree with me), but I have no idea how specifically one could "reduce a non-periodic infinite number in a prime factor".

Replies from: AlexMennen
comment by AlexMennen · 2022-03-26T02:56:56.194Z · LW(p) · GW(p)

If you have a 10-adic integer, and you want to reduce it to a 5-adic integer, then to know its last n digits in base 5, you just need to know what it is modulo . If you know what it is modulo , then you can reduce it module , so you only need to look at the last n digits in base 10 to find its last n digits in base 5. So a base-10 integer ending in ...93 becomes a base-5 integer ending in ...33, because 93 mod 25 is 18, which, expressed in base 5, is 33.

The Chinese remainder theorem tells us that we can go backwards: given a 5-adic integer and a 2-adic integer, there's exactly one 10-adic integer that reduces to each of them. Let's say we want the 10-adic integer that's 1 in base 5 and -1 in base 2. The last digit is the digit that's 1 mod 5 and 1 mod 2 (i.e. 1). The last 2 digits are the number from 0 to 99 that's 1 mod 25 and 3 mod 4 (i.e. 51). The last 3 digits are the number from 0 to 999 that's 1 mod 125 and 7 mod 8 (i.e. 751). And so on.

comment by Oscar_Cunningham · 2022-03-24T09:01:55.275Z · LW(p) · GW(p)

If we start with 5 and start squaring we get 5, 25, 625, 390625, 152587890625.... Note how some of the end digits are staying the same each time. If we continue this process we get a number ...8212890625 which is a solution of x^2 = x. We get another solution by subtracting this from 1 to get ...1888119476.

Replies from: Viliam
comment by Viliam · 2022-03-24T14:21:54.958Z · LW(p) · GW(p)

I may be missing something, but it is not obvious to me why the number of digits at the end that stay the same is necessarily always increasing.

I mean, the last N digits of x^2 depend on the last N digits of x. But it requires an explanation why the last N+1 digits of x^2 would be determined by the last N digits of x.

I can visualize a possibility that perhaps at certain place a digit in 5^(2^k) starts changing periodically. Why would that not be the case? Also, is there something special about 5, or is the same true for all numbers?

Replies from: Oscar_Cunningham
comment by Oscar_Cunningham · 2022-03-24T15:27:14.600Z · LW(p) · GW(p)

You just have to carefully do the algebra to get an inductive argument. The fact that the last digit is 5 is used directly.

Suppose n is a number that ends in 5, and such that the last N digits stay the same when you square it. We want to prove that the last N+1 digits stay the same when you square n^2.

We can write n = m*10^N + p, where p has N digits, and so n^2 = m^2*10^(2N) + 2mp*10^N + p^2. Note that since 2p ends in 0, the term 2mp*10^N actually divides by 10^(N+1). Then since the two larger terms divide by 10^N+1, n^2 agrees with p^2 on its last N+1 digits, and so p^2 agrees with p on at least its last N digits. So we may write p^2 = q*10^N + p. Hence n^2 = m^2*10^(2N) + 2mp*10^N + q*10^N + p.

Squaring this yields (n^2)^2 = (terms dividing by 10^(N+1)) + 2qp*10^N + p^2. Again, 2p ends in 0, so 2qp*10^N also divides by 10^(N+1). So the last N+1 digits of this agree with p^2, which we previously established also agrees with n^2. QED

A similar argument shows that the number generated in this way is the only 10-adic number that ends in 5 and squares to itself. So we also have that one minus this number is the only 10-adic ending in 6 that squares to itself. You can also prove that 0 and 1 are the only numbers ending in 0 and 1 that square to themselves. The other digits can't square to themselves. So x^2 = x has precisely four solutions.

Replies from: Viliam
comment by Viliam · 2022-03-24T16:14:00.622Z · LW(p) · GW(p)

Amazing!

Replies from: army1987, gjm
comment by A1987dM (army1987) · 2023-04-21T21:32:55.939Z · LW(p) · GW(p)

BTW, see http://www.numericana.com/answer/p-adic.htm#decimal for solutions to x^3 = x, x^4 = x etc.

comment by gjm · 2022-03-24T18:11:32.103Z · LW(p) · GW(p)

Note that this works fine in the 10-adics but not in the p-adics for any prime p, because a polynomial over a field can't have more roots than its degree.

comment by Dirichlet-to-Neumann · 2022-03-24T21:59:55.721Z · LW(p) · GW(p)

I just want to add that the topology of the p-addic numbers is weird. Like, super weird : it's totally disconnected, all triangles are isosceles, and if a sequence converges to 0, its series converges too.