 This is the second part of a talk on periodic numbers for the Berkeley Mathematics Circle. For the first part of the talk, or for links to the Berkeley Math Circle site, see the description of the video. So at the end of the first part of the talk, we were talking about a problem with 10-addict integers. So remember with 10-addict integers, we had this problem that you could find two numbers A and B, so that A, B was equal to naught, but A was not equal to naught and B was not equal to naught. And this is really rather a problem. And the problem arises from the fact that 10 is not prime. So we have two times five equals naught, modulo 10, but two is not equal to naught, modulo 10 and five is not equal to naught. So this suggests that instead of using 10-addict integers, we should work with p-addict integers, where p is a prime. And what we can do is we can just copy all the things we did for 10-addict integers for p-addict integers. So we have addition, subtraction, multiplication, and we can divide by any p-addict integer if the last digit is not zero, so by anything not divisible by p. And there's one slightly confusing thing here because we can define the reals in base 10, or we can define the reals in base two. And there's no real difference between them. If we do real numbers in base 10, we're really doing the same thing as in base two, except the notation is a little bit different. However, the 10-addict integers are not the same as two-addict integers at all. For example, the 10-addict integers, we can have AB equals zero with AB not zero, but the two-addict integers have the property that if AB equals zero, then A or B is equal to zero. More generally, if we define the p-addict integers for various different primes, we find the p-addict integers are not equal to the q-addict integers if p is not equal to q and p and q are primes. It's sometimes possible for the two sorts of addict integers to be the same. For instance, the 10-addict integers are the same as the 100-addict integers if you think about it a bit too, writing a number in base 100 is almost the same as writing it in base 10, except that you have half a number of digits or something. So, well, we should just check that what I said about the p-addict numbers being having no zero divisors. So suppose that we have two p-addict numbers and let's write them out in base p. So it might end in a few zeros and then it might have a digit x and a digit y and a digit z. And as you remember, it can go on infinitely far to the left. And we might have another one which maybe looks like this and then its digits might look like this. And we can choose x not equal to zero and A not equal to zero if the numbers are none zero. So we're choosing to none zero p-addict numbers and now we multiply them together. Well, if we multiply them together, we're going to get five zeros at the end. And then this will be A times x modulo p. And since p is prime, this implies A x is not zero modulo p, so this is none zero. So we've shown that if p is prime and you multiply together two p-addict integers, you get something that's none zero. So we say that the p-addicts have no zero divisors. So zero divisor means that x, y equals naught when x is not equal to zero or y is not equal to zero. And that's a rather unpleasant property. And we've managed to exclude this. Now, a consequence of this is that a p-addict integer has at most two square roots. So we found a problem with the 10-addict integers is that the number could have four square roots, which is a bit disconcerting. So suppose A squared is equal to B squared. So suppose A and B have the same square, then you can factor this as saying A minus B times A plus B is equal to zero. Now, since there are no zero divisors, this means A minus B equals zero or A plus B equals zero. In other words, A equals B or A equals minus B. In other words, there can be at most two numbers with the same square because the only possibilities are that either equal or each other's negatives. Well, what else can we do with the p-addict integers? Well, you remember, we have the fundamental theorem of arithmetic, which says that if you've got an integer n, you can write this as a unit, which is plus or minus one times a product of primes. And you can do this in a unique way. Well, when I say unique, it means opt to order and possibly opt to units. That should be a non-zero integer, of course. And we can do the same for p-addict integers, except it's much simpler because suppose I take a p-addict integer like it might be something like two, one, three, four, zero, zero, zero, zero point something. And then I can write this as p to the four times the p-addict integer two, one, three, four. And this is a unit because it ends in something that's non-zero. And you remember for p-addict numbers, for p-prime, it's a unit provided the last digit has an inverse mod p. And that's always true for if the last digit is not divisible by the prime p. So we see there's only one prime. The only prime is p and every p-addict integer is equal to p to the n times a unit for some n. So for the integers, we only had two units, which were plus or minus one, but here we've got a huge number of units because anything with non-zero last digit will be a unit. So the arithmetic is much easier for the p-addict numbers than for the ordinary integers. In fact, this idea is used quite a bit in number theory because it means you can concentrate on just one prime. So normally when you work with the integers, it's rather complicated because there are so many different primes. But with the p-addict numbers, you only have to worry about one prime at a time. And in fact, you're quite often split problems in the integers into a problem for each prime. And you can then study the problem for each individual prime by using the p-addict integers. So next for the integers, we can construct the rational numbers. So if we've got integers, we can't always do division of integers, of course. Well, if you want to do division, we have to go to the rational numbers. So you can think of a rational number as being a sort of pair of integers m over n, where m over n is considered to be the same as m1 over n1, if mn1 equals nm1. Here n and n1 are not zero, of course. So this allows you to do division by all non-zero integers. So now we're going to do the same for the p-addict integers. And this goes to, I guess you could call them the p-addict rationals, although they're not usually called that. They usually just called p-addict numbers. And these are going to be at the form m over n with n not equal to zero, where m and n are p-addict integers. Well, we've discussed the prime factorization and you know that you can write n is equal to p to the k times a unit. Well, there's no point in dividing by a unit because we've already got an inverse of it. So you can write any p-addict rational as something of the form n over p to the k for k some integer and m a p-addict integer. Well, it's pretty obvious how we should divide by p to the k. You know in base 10, if you want to divide by 10, you just shift the number one space to the left. So for p-addict numbers, if we want to divide by 10, we just shift to the left. So for example, if I've got a p-addict number, something rather two, one, three, four and point zero, zero, zero. If I want to divide it by p cubed, all I do is shift it to the left. So I get something, something, something 2.134. This is in base p, of course. So a p-addict rational looks like this. It has an infinite string of numbers before the decimal point, except I guess it's not a decimal point. It's a periodic point. And then it has a finite number after. So here this is finite and this is an infinite string. You can contrast this with real numbers. So real numbers look like this. So here we have a real number. It might look like 3.14159 and so on. And here we have an infinite string. And here we have a finite string before the point, whereas a p-addict number is kind of the other way around. We might have a finite string there and an infinite string here. So this is infinite and this string is now finite. Of course, we could also allow a finite string on both sides, but that wouldn't be terribly interesting. It would just be rational numbers whose denominator was a power of p. And you can ask what happens if you allow the string on both sides to be infinite? Well, if you try doing that, it turns out that it just doesn't make very much sense. For example, if I take a number 1111111 and allow an infinite string of ones on the other side, what happens if I try squaring this? Well, how am I going to work at this digit here? I have to work it out as this number times plus that times that, plus that times that, plus that times that. And I just have to add up an infinite number of ordinary integers, which doesn't make sense. So multiplication just isn't defined if you allow it to be infinite on both sides. So anyway, so the p-addict rationals now have the following operations. We can do addition, subtraction, multiplication and division by non-zero elements. So if you can do all these four operations and they satisfy the usual rules of arithmetic, mathematicians call this a field. So the p-addict numbers, or the p-addict rational numbers form a field. And other examples are the real numbers and the rational numbers and the complex numbers if you've done complex numbers. So what else can we do with p-addict numbers? Well, we were talking about taking square roots of 10-addict numbers and we ran into problems. So let's try square roots for p-addict numbers and see what happens. And to give some explicit example, let's do the three-addict integers. Let's try and see if they have square roots. So let's write down a three-addict integer, two, one, zero, one, zero, zero, zero, point, something. So this as usual is in base three. And we can ask, does it have a square root? And the answer is no, because if we take any three-addict number, suppose we take any non-zero three-addict number. Suppose this is non-zero and suppose you take the square of this. Well, what will happen is if this ends in three zeros, its square will end in six zeros and then it will end in something non-zero because it will have the square of this number here and some other things there. So the square has an even number of zeros at the end of it. And here we see that there are only an odd number of zeros. So this number here doesn't have a square root. Well, what happens if it does have an even number of zeros at the end? Well, if it's got an even number of zeros, you can keep dividing by three squared to get no zeros at all at the end. So we may as well look at numbers that just end in something non-zero. So let's look at number 21, zero, one, two. This is in base three. And does it have a square root? And the answer is no. And the reason this doesn't have a square root is a little bit more subtle. So let's try taking the square of something, some three-addict number that ends in a one. What's the square of that going to look like? Well, one squared is going to give the last digit as one. What happens if we take something ending in two? Well, two squared is one, one in base three. So the last digit will again be one. And the only possible last digit is a one and two or zero, but we said we were just dividing out by multiples of three to get rid of the zero. So the last digit, so the last non-zero digit or possibly the first non-zero digit depending on which way you're counting must be one unless the number is identically zero. So this number is not a square because we can't get two at the end. So this digit two at the end is the obstruction to it being a square. Okay, so what happens if we have an even number of zeros and the last digit is one? So what about the number two one? This is base three, so it's really the number seven in base 10. And does it have a square root? And the answer is yes, seven does have a square root in the p-addicts and let's try and calculate it. So what's its square root going to be? Well, the square root is going to be something, something, something. And then the last digit has to square to one. So it can either be one or two and we're going to take the last digit to be a one. We could also do the last digit two that would sort of give minus this square root. And the next last digit is some number A and we want to try and figure out what A is. So let's work out what is A one or squared? Well, if we work it out, the last digit of this will be one and the next to last digit will be two A and then we will get something there that we don't really care about. And we want this to be equal to two one. So we want two A equals two, so A equals one. So we've managed to figure out what A is. Now let's try and work out the next digit. So we've got something, something, something B one one. And now the square of this is now where we get one two one from squaring one one in base three. And then we get a plus two B in this place here from B times this twice. And this has to be equal to zero to one. There's some dots there. So we see one plus two B must be zero in order for that digit to be the same as that digit. And we can solve for this and we see B is equal to one. This is, this is of course, modulo three. So now we found the next digit of our square root. It looks like something, something, something C one one one. And now we want to work out what is the next digit? I mean, are we just gonna get ones all the way? Well, let's try and see. Well, one one one squared is going to be one two three two one, and then we want C times one twice. So here we get a digit two C. So, so we want to add up these two. Well, we can't really have a three there because, and that's not a digit, we should really have carried that. So if we had these up, we get one two zero and then we carry one from this and we get three, which carries and then we just get a two C here and then we get something there. So we find two C must be zero. So C equals zero. So the square root of two one in base, in base, writing this as base three is something, something, something zero one one one point. And we can obviously just keep going like this. So at each step, we have to divide by two, we have to divide something by two. You notice we always get two B equals something, two C equals something, two A equals something. So as long as we can divide by two, we can just keep going. And since we're working in base three, we can divide by two in base three. So seven has a square root. And for similar reasons, anything whose last digit is one will have a square root, which you can work out in a similar way. So let's just summarize. So when does a number have a square root mod three? So a periodic integer has a square root. So let me do, let me do three other integers. First, I'll do a periodic in a moment has a square root if it ends in an even number of zeros. And secondly, the last non-zero digit, is a one. So you see that in some sense, one quarter of all three-addict integers have a square root because half of them have an even end in an even number of zeros and half of them have lost one rather than last digit zero. That's from non-zero three-addict integers. Of course, the number zero has a square root but has an infinite number of zeros at the end. So this is a little bit different from the reals because for the reals, half of all reals have square roots because the positive ones have square roots and the negative ones don't. So what about other primes, p? And well, there's a sort of little tricky problem here. So p, so n has a square root in the p and x if, first of all, it ends in an even number of zeros. Secondly, the last digit is a square mod p because if it's a square mod p, we can take its square root to get the first digit and carry on. For example, let's just see what happens if p equals seven. Then if the first digit has a square root then if you take the last digit to be nought one, two, three, four, five, or six and square it, you see you get nought one, four, two, two, four, one. So the possible last digits for squares mod seven are one, four, and two. And you see this is again half the possible digits modulo seven. Well, there's actually a third condition. You remember that in working out the square root we needed to divide by two and we can't do this if p is equal to two. So we'd better have the condition that p is not equal to two because if p is equal to two, things get a little bit more complicated. So let's just see what happens if p equals two. And there's a general rule in mathematics that things always go wrong for the prime two. It's an exception to almost everything. So let's have a look at what about the number one, zero, one in base two, which is equal to five if you're working in base 10. Does it have a square root in the two add it integers? Well, let's check it, end in an even number of zeros. So that's okay. And secondly, the last digit is one which is obviously a square mod two. So this satisfies all the conditions for something to have a square in the pnx of p odd. However, it doesn't have a square in the two addicts. Let's look at squares mod eight. So here I'm going to write out the numbers zero, one, two, three, four, five, six, seven. And I'm going to write them in binary because we should really be working. If we don't work in the two addicts, we should be doing everything in binary. And now let's work out the square, last three digits of the square. Well, that would be zero, zero, zero, zero, one, one, zero, zero, zero, one, zero, zero, zero, zero, one, one, zero, zero, zero, zero, one. So the only possibilities for a square in the two addicts is the last three digits on zero, zero, zero, or zero, zero, one, or one, zero, zero. And you notice one, zero, one doesn't appear on the list. So no two addicts square can end in one, zero, one. So things are definitely rather more complicated. If you want to know what the squares in the two addicts are, it turns out that something is a square in the two addicts if it ends in an even number of zeros and the last three, and once you've taken out all the zeros, the last three digits have to be zero, zero, one. And once you've got a zero, zero, one at the end, you can then carry on finding all the other digits of the square root. Well, obviously you can ask about cube roots and fifth roots and any other sort of roots you like. I'm not going to discuss this because they are too different for the square roots. The only thing to notice is that cube roots go wrong for the three addict integers and fifth roots go wrong for the five addict integers. And it's sort of fairly obvious why that when you're working out square roots, you need to divide by two all the time. When you work out cube roots, you need to divide by three all the time and so on. So for three addicts, things are gonna get messed up. Well, what about powers A to the B? So we've been looking at the special case square roots and fifth roots are just A to the one third and A to the one fifth. Why don't we look at powers A to the B with A and B, P addict numbers? So instead of saying that B just has to be a half or something, why don't we allow B to be any P addict number? And there are several ways of doing this. I'm going to do a way that uses some P addict analysis as an excuse to show what P addict analysis is. So first of all, how can we define A to the B for the reals? Well, again, there are several ways of defining it for the reals, but one way is to define A to the B equals E to the B times log of A. Here I'm using log of A to be the natural log. So people quite often denote this by LN of A. In mathematics, in pure mathematics, people usually use log for natural log in engineering and in high school and physics. People quite often use LN. This is for complicated historical reasons that log sometimes used to mean log to base 10. So about a century ago, someone decided with a good idea to have a different notation from natural logs. But since nobody in their right mind uses logs to base 10 anymore, we may as well use logs, the term log for natural log. Anyway, so this means natural log. And E is the base of natural logarithms. So it's 2.7182818 and so on. And this can be written as a sum, one over zero factorial plus one over one factorial plus one over two factorial plus one over three factorial and so on. And we don't seem to have gained anything because we seem to reduce the problem of working out A to the power of B to the problem of working out E to the power of something which looks just as difficult. But the point is there's a very easy way of working out E to the power of something because E to the power of X is equal to one plus X plus X squared over two factorial plus X cubed over three factorial plus X to the four over four factorial and so on. So working out arbitrary powers is a bit of a mess but working out E to the power of something turns out to be a very neat formula for it. And similarly, working out logarithms there's also a rather neat formula for it because log of one plus X is X minus X squared over two plus X cubed over three minus X to the four over four and so on provided X is absolutely value less than one. So this gives us a formula for A to the power of B for some real numbers. I mean, we've got this condition X is less than one but we won't worry about that too much. And what we want to do now is to try and copy this for the P-addict numbers. And then if we can do this, we will define, we will define powers of P-addict numbers. Well, there's a bit of a complication here because we've got these infinite sums and it's not at all clear what these infinite sums mean for especially for P-addict numbers. So let's discuss this. So let's just look at infinite sums for the reals. And there are various infinite sums you can have. For instance, you can take the sum one plus a half plus a quarter plus an eighth plus a 16th. And the way you define this is you look at the sequence of partial sums one, one plus a half, one plus a half plus a quarter. And so this is one, 1.5, 1.75 and so on. And these numbers get closer to the number two which is the sum of this infinite series. Now, the sum of real numbers is a bit tricky because let's look at the following sum of real numbers, one minus a half plus a third minus a quarter plus a fifth and so on. And if you've been to a calculus course, you know this actually converges. In fact, it converges to the number log of two. However, if I change the signs of it a bit, one plus a half plus a third plus a quarter plus a fifth, what does this converge to? Well, it doesn't have a sum. This just gets bigger and bigger and becomes infinite. And you can see this because if you look at this term, it's bigger than it's at least a half. If you look at the sum of these two terms, a third plus a quarter is more than a quarter plus a quarter which is bigger than a half. And if you look at all the terms going from a fifth to an eighth, we've got four terms each which is at least an eighth. So that's bigger than a half. And if we go from a ninth to a sixteenth, that's bigger than a half. And in general, each time we double the number of terms we take and the sum of these terms is at least a half. So we're sort of adding up a half plus a half plus a half plus a half plus a half and so on. This just doesn't converge. So although these real numbers get smaller and smaller and smaller, we can't add them all up. And the next question is, what do we mean by a real number getting smaller? Well, what we mean by a real number is, we say a real number is small, just means that the real number X, it just means that the absolute value of X is less than epsilon for some small number at silence, say less than a millionth. Well, the absolute value of X is X if X is greater than zero and minus X if X is less than zero. And what we're going to do is, is have something like this for p-addict numbers. So we want you to find a p-addict absolute value. And we will say that a p-addict number is very small if it's p-addict absolute value is small. And this is defined as follows. Suppose n is equal to a unit times p to the k, then we define the p-addict absolute value, and p to be p to the minus k. So the idea of this is as follows, suppose you've got a p-addict number two, three, one, four, zero, zero, zero, zero, zero. What we want to do is to say it's very small because it's got a lot of zeros here. So this is equal to p to the five times some unit. So the p-addict absolute value of this number is going to be p to the minus five, which is a rational number. So it's a little bit confusing because this number looks really big, but in fact, we want to say it's really small because it's got a lot of zeros here. And you can see if you take a lot of p-addict numbers that get more and more zeros in them, suppose I take a p-addict number one, two, three, something or other, and another one, zero, four, five, and another one, point zero, zero, six, seven, eight. The number of zeros is getting bigger and bigger, so I can add these all up even if they're an infinite number of them. For instance, here I'll get one and here I'll get six and so on. So the notion of p-addict numbers getting small is a bit weird because it looks as if they're getting big. So for example, if I took, suppose I take the following sequence of numbers, suppose I take one, one, zero, one, zero, zero, one, zero, zero, zero, one, zero, zero, zero, zero. Now if I add these up as real numbers, it doesn't make sense, it's going to be infinite. If I add them up as p-addict numbers, there's no problem because I just get this number here it doesn't really matter, it goes on infinitely far to the left. So the way to sum p-addict numbers is actually easier than for real numbers. So suppose a one, a two, a three, and so on are p-addicts. Then the sum a one plus a two plus a three and so on exists if the p-addict absolute values of the AI get smaller. In other words, tend to zero. I really ought to give a precise definition of what I mean by this, but everybody always gets confused by this. So I'll just be informal and say that the p-addict sizes of these must get smaller and smaller. And that's because if the p-addict sizes are getting smaller and smaller, then the number of zeros at the end is getting bigger and bigger, so you can add them up. Notice that this just fails for the reals. We had this series before one plus a half plus a third plus a quarter and so on. The absolute value of one over n tends to zero, but this series doesn't converge. And for this reason, dealing with series for real numbers is really quite complicated, but dealing with series for p-addict numbers is very much easier. So let's go back to the problem and try and work out whether we can define p-addict exponentials and logarithms. So we want to define e to the x and log of x for p-addicts. Well, first of all, what is e to the x? Well, it doesn't make sense because there's no p-addict number e. What is e? Well, we said it was one plus a half plus one over six plus one over 24 and so on. So these are plus one over n factorial. Now, over the real numbers, these numbers get very, very small, very rapidly, so there's some converges. But what happens over the p-addicts? Well, let's do the two-addicts. We get one and then we get a half. Well, in the two-addict numbers, that's 0.1 and then we get one over six and that's going to be something 0.1 here and then we get one over 24. That's going to be something, something, something, 0.0, something, something, one. So the p-addict numbers are actually getting worse and worse and worse and instead of getting more and more zeros which makes them easier to adopt, they're getting fewer and fewer zeros. So this just does not converge. So convergence is very funny. Some things converge in the reals but not in the p-addicts and some things converge in the p-addicts but not the reals. So we can't work with e to the x. That doesn't really matter because we can instead just work with x but of x and define this to be one plus x plus x squared over two factorial plus x cubed over three factorial and so on. And so for the real numbers, x with x is just equal to e to the x but for the p-addict numbers, this doesn't make sense but this still does. And now we have the problem. When does this converge? And we can also ask when does log of x converge? So we're again defining log of x to be x minus x squared over two plus x cubed over three and so on. And we just pointed out, we just said that for the reals, this always converges. So this is always for reals and this is for x is less than one and sometimes for x having absolute value equal to one for the reals. But what about for the p-addicts? Well, we've just seen that if x is equal to one, this doesn't converge for the p-addicts. So things are, although they're analogous to the reals, they're a little bit different. So the problem is that these numbers, these coefficients here are small for the reals but quite big for the p-addicts. Well, let's see if they sometimes converge. So let's try and work out x of three in the three-addicts and see whether it converges. Well, we have one plus three squared over two factorial plus three cubed over three factorial plus three to the four over four factorial and so on. And let's write these numbers in base three. So that's going to be a one and that's going to be not something, not point something. This is a three squared. So it's going to be something not not point and this is a three cubed over three factorial. So it'll gain end in two zeros and this will now end in three zeros and so on. So you can see the number of zeros this ends with, if you write it out three-addictly seems to be increasing which suggests that it should converge. So let's take a look at this more precisely. So let's look at the numbers naught factorial, one factorial, two factorial, three factorial, four factorial, five factorial and so on and see how many zeros does this end with if you write in base three. Well, these end in no zeros. This ends in one zero. This ends in two zeros because we've got another factor of three here. So every time we go up by three, we add one to the number of zeros at the end, right? Well, no, because here we have to add two zeros because we've got a factor of nine. So go four, four, four, five and so on. And you can see the number of zeros at the end of n factorial is, well, this means we take the integer part of n over three and then we have to take the integer part over n over nine and then the integer part of n over 27 and so on. Whereas on the other hand, the number of zeros of three to the zero, three to the one, three to the two and so on goes like zero, one, two, three, four, five, six, seven. And you can see it, this series here is growing much faster than this sequence here. It's growing at about twice the speed. So this actually converges in the three addyx. So we can define the three addyx exponential function. And we can calculate the first few terms of it as follows. For instance, we can calculate one plus three plus three squared over two factorial plus three cubed over three factorial. And we add these up as one is zero, zero, one. Three is zero, one, zero point something, three squared over two factorial looks like zero, zero, two, one, one, one, one, one. And then we get a three cubed over three factorial and this gives us zero, zero, two, one, one, one, one. And the next term will give us three zeros and then something or other. So we can add these up and we get one, one, two plus two is four, which is one, something or other. So these are the last three digits of x of three in the three addyx. And in fact, x of x exists in the p of x, the addyx if x is divisible by p, in other words, it's last digits p and something else goes wrong. What goes wrong is that for p equals two, sorry, p equals two things don't really work. p equals two always goes wrong. Okay, I think I'll leave it that for this part of the lecture. So the third and final part of the lecture will be about the p-addic gamma function, which is normally an advanced graduate level topic. So I don't quite know why I'm giving it in a lecture for advanced school students.