1. Home
  2. Explore
  3. Mathematics
  4. Self-Squaring Numbers

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Self-Squaring Numbers

Study Notes: P-adic Numbers and Their Uses

Infinite expansions and numbers that are their own squares

In an ordinary decimal expansion, digits to the right of the decimal point represent successively smaller powers of 101010. A 10-adic expansion instead uses an unlimited sequence of digits extending to the left from the units digit:

⋯a3a2a1a0\cdots a_3a_2a_1a_0⋯a3​a2​a1​a0​

Here, a0a_0a0​ is the units digit, a1a_1a1​ is the coefficient of 101010, a2a_2a2​ is the coefficient of 10210^2102, and so on. Informally, the expansion represents

a0+a1⋅10+a2⋅102+a3⋅103+⋯ .a_0+a_1\cdot 10+a_2\cdot 10^2+a_3\cdot 10^3+\cdots.a0​+a1​⋅10+a2​⋅102+a3​⋅103+⋯.

The same idea works in any base. In base ppp, where ppp is prime, the digits are 0,1,…,p−10,1,\ldots,p-10,1,…,p−1, and an expansion represents an infinite sum of powers of ppp.

A striking pattern appears when repeatedly squaring numbers built from powers of 555:

  • 52=255^2=2552=25, which ends in 555.

  • 252=62525^2=625252=625, which ends in 252525.

  • 6252=390625625^2=3906256252=390625, which ends in 625625625.

  • Further squaring continues to produce longer matching endings.

The matching endings are important: each new result agrees with the previous number in more and more of its rightmost digits. This suggests constructing an infinite digit sequence by successively determining digits that make the sequence agree with its own square.

In the resulting 10-adic system, the number can satisfy

n2=nn^2=nn2=n

without being either 000 or 111. Such a number is an idempotent: an element unchanged by squaring. Its infinitely many digits do not represent a real number with an infinitely large magnitude. Instead, they describe a number in a different system, with a different notion of distance and convergence.

An infinite p-adic expansion is meaningful because its digits are specified consistently from the units place toward higher powers of the base. It is not interpreted using ordinary real-number size.


Arithmetic with 10-adic numbers

Addition and multiplication

Addition works digit by digit, from the units place toward the left, carrying whenever a digit sum reaches the base. For example, adding 999 and 111 gives 000 in the units place and carries 111 to the next place.

Multiplication also proceeds from the units place toward the left. The key feature is that the answer’s first few digits depend only on the first few digits of the inputs. A higher digit can be determined after enough lower-place multiplication and carrying has been completed. This means the arithmetic can be continued to determine as many digits as needed.

Fractions can appear as digit strings

Some ordinary fractions can be represented as 10-adic digit expansions, even though no division symbol is used in the expansion itself. For example, a 10-adic number can be found whose product with 777 is 111. Its digits are determined successively by working from right to left with the usual multiplication and carrying rules. It therefore represents the reciprocal of 777 in the 10-adic system.

A similar calculation finds the 10-adic representation of 13\frac{1}{3}31​. To make a product with 333 end in 111, the units digit must be 777, because 3⋅7=213\cdot 7=213⋅7=21. The resulting carry is 222. At each next position, a digit of 666 works because

3⋅6+2=20.3\cdot 6+2=20.3⋅6+2=20.

This produces another 000 and carries 222 again. Repeating this step gives an infinite string of 666s to the left of the final 777. Thus the 10-adic expansion with units digit 777 and all preceding digits equal to 666 represents 13\frac{1}{3}31​.

More generally, fractions whose denominators are relatively prime to 101010 have 10-adic representations. The description of “fractions” must be understood in relation to the base: not every rational number has a 10-adic integer expansion.

Negative numbers without a minus sign

An infinite string of 999s in base 101010 represents −1-1−1 in the 10-adic system. Let mmm denote that string. Multiplying by 101010 shifts the digits one place, inserting a 000 in the units place. Subtracting the shifted version from the original gives

9=−9m,9=-9m,9=−9m,

so m=−1m=-1m=−1.

The result can also be checked directly by addition. Adding 111 to the string of all 999s makes the units digits sum to 101010, producing a 000 and a carry. Every following pair of digits repeats the same process. Because there is no final leftmost digit, the carry never reaches an endpoint; every digit becomes 000. Thus the all-999 string plus 111 equals 000.

This also explains why a string of 999s followed by a units digit of 333 represents −7-7−7: it is the 10-adic form of −1+?-1+?−1+?, with the finite ending interpreted using place value and carrying.

To find the negative of a finite or infinite 10-adic digit string, one can use the 9s complement:

  1. Replace each digit ddd by 9−d9-d9−d.

  2. Add 111.

This is the base-10 version of the familiar complement method for representing negative integers. Subtraction can then be performed by adding the negative of the number being subtracted.

In this system, addition, subtraction, and multiplication are defined using digit operations and carrying. Fractions and negative values can be encoded by the expansions themselves, without writing a separate division or negative sign.


Why a composite base causes trouble

The 10-adic system has a significant algebraic drawback. Since 101010 is composite,

10=2⋅5,10=2\cdot 5,10=2⋅5,

two nonzero numbers can multiply to give 000 in a 10-adic system. At the units place, for instance, 5⋅4=205\cdot 4=205⋅4=20 ends in 000. The carries can be continued in ways that construct nonzero 10-adic numbers whose product is zero. Such elements are called zero divisors.

This creates a problem for solving equations by factoring. In ordinary arithmetic, if

ab=0,ab=0,ab=0,

then at least one of aaa or bbb must be zero. That fact lets mathematicians factor an equation and solve the smaller equations given by its factors. In a system with zero divisors, a product can be zero even when neither factor is zero.

The nontrivial idempotent arising from the repeated-squaring pattern illustrates the issue. If n2=nn^2=nn2=n, then

n(n−1)=0.n(n-1)=0.n(n−1)=0.

In a number system without zero divisors, this equation forces n=0n=0n=0 or n=1n=1n=1. A 10-adic idempotent different from both values can exist precisely because the 10-adic system has zero divisors.


Prime bases and p-adic numbers

To avoid zero divisors, mathematicians use a prime base ppp. The resulting systems are called p-adic numbers. In base 333, for example, the only possible digits are 000, 111, and 222.

In a prime base, the product of two nonzero digits cannot be divisible by the base. For base 333, the nonzero digits are 111 and 222, and

1⋅1=1,1⋅2=2,2⋅2=4=113.1\cdot 1=1,\qquad 1\cdot 2=2,\qquad 2\cdot 2=4=11_3.1⋅1=1,1⋅2=2,2⋅2=4=113​.

None of these products is 000 in the units place. The same principle holds at each successive place. In a p-adic system with prime base ppp, a product is zero only if at least one of its factors is zero. Thus the system has no zero divisors, and the useful factorization property is restored.

A p-adic expansion has the form

a0+a1p+a2p2+a3p3+⋯ ,a_0+a_1p+a_2p^2+a_3p^3+\cdots,a0​+a1​p+a2​p2+a3​p3+⋯,

where each coefficient aia_iai​ is one of 0,1,…,p−10,1,\ldots,p-10,1,…,p−1. The p-adic integers use nonnegative powers of ppp. The larger p-adic number system also includes fractions and numbers with negative powers of ppp.

In the 3-adic integers, an infinite string of 222s represents −1-1−1. Adding 111 makes the units digits sum to 333, which is 10310_3103​: the units digit becomes 000 and a carry of 111 continues to the next place. This repeats indefinitely, just as the all-999 string plus 111 does in base 101010.


Modular arithmetic and reading base expansions

Modular arithmetic keeps track of remainders. Working modulo mmm means treating numbers that differ by a multiple of mmm as equivalent. The remainder after division by mmm determines the value modulo mmm.

A clock illustrates arithmetic modulo 121212: after 111111 comes 000 again. For instance, 141414 o’clock corresponds to 222 o’clock on a 12-hour clock because 141414 leaves remainder 222 when divided by 121212. In general,

36≡6(mod10)36\equiv 6\pmod{10}36≡6(mod10)

because 363636 leaves remainder 666 on division by 101010, and

25≡0(mod5)25\equiv 0\pmod{5}25≡0(mod5)

because 252525 is a multiple of 555.

A base-333 clock has the digits 000, 111, and 222. Multiplying 222 by 222 gives 444, which is congruent to 111 modulo 333, since 444 leaves remainder 111 after division by 333.

Modular arithmetic also provides a systematic way to find the digits of a base expansion. To write 171717 in base 333:

  1. The remainder on division of 171717 by 333 is 222, so the units digit is 222.

  2. The remainder on division by 999 is 888. After accounting for the units contribution 222, the remaining amount is 6=2⋅36=2\cdot 36=2⋅3, so the next digit is 222.

  3. The remainder on division by 272727 is 171717. The already accounted-for lower-place value is 888, leaving 9=1⋅99=1\cdot 99=1⋅9, so the next digit is 111.

Therefore,

17=1223.17=122_3.17=1223​.

Solving equations one digit at a time

The Diophantine problem

A Diophantine equation is a polynomial equation for which solutions are sought in a specified number system, often the integers or rational numbers. A well-known example is the Pythagorean equation

x2+y2=z2.x^2+y^2=z^2.x2+y2=z2.

It has many real solutions, forming a continuous geometric set, but its integer and rational solutions are more selective. Examples of integer solutions include (3,4,5)(3,4,5)(3,4,5) and (5,12,13)(5,12,13)(5,12,13).

A more intricate example asks for three squares whose areas add to the area of a larger square, under the condition that the side length of each square is the area of the preceding one. If the first square has side length xxx, then the three areas are x2x^2x2, x4x^4x4, and x8x^8x8. The condition that their total is another square is

x2+x4+x8=y2.x^2+x^4+x^8=y^2.x2+x4+x8=y2.

The equation has real solutions—for example, x=1x=1x=1 gives y=3y=\sqrt{3}y=3​. But the aim is to find rational solutions, which is a much more restrictive problem.

Hensel-style expansions in powers of a prime

One approach is to seek a solution in the form of a base-333 expansion:

x=x0+x1⋅3+x2⋅32+x3⋅33+⋯ ,x=x_0+x_1\cdot 3+x_2\cdot 3^2+x_3\cdot 3^3+\cdots,x=x0​+x1​⋅3+x2​⋅32+x3​⋅33+⋯,

where each coefficient xix_ixi​ is 000, 111, or 222. The value yyy can be expanded in the same way.

Directly substituting two infinite expansions into the equation looks complicated. Modular arithmetic simplifies the work: the first coefficient is found by solving the equation modulo 333, the next by solving modulo 999, then modulo 272727, and so on. Each modulus reveals one more digit.

First approximation: modulo 333

Modulo 333, every term containing a factor of 333 vanishes, so only the first coefficients matter:

x02+x04+x08≡y02(mod3).x_0^2+x_0^4+x_0^8\equiv y_0^2\pmod{3}.x02​+x04​+x08​≡y02​(mod3).

The coefficient x0x_0x0​ can be 000, 111, or 222.

  • If x0=0x_0=0x0​=0, the left side is 000 modulo 333.

  • If x0=1x_0=1x0​=1, the three powers are all 111, so their sum is 3≡0(mod3)3\equiv 0\pmod{3}3≡0(mod3).

  • If x0=2x_0=2x0​=2, then 22≡1(mod3)2^2\equiv 1\pmod{3}22≡1(mod3), and its fourth and eighth powers are also congruent to 111. Their sum is again 3≡0(mod3)3\equiv 0\pmod{3}3≡0(mod3).

Thus the left side is 000 for every possible x0x_0x0​. The only value of y0y_0y0​ whose square is 000 modulo 333 is y0=0y_0=0y0​=0. The possible first-digit pairs are therefore

(x0,y0)=(0,0), (1,0), (2,0).(x_0,y_0)=(0,0),\ (1,0),\ (2,0).(x0​,y0​)=(0,0), (1,0), (2,0).

The pair (0,0)(0,0)(0,0) gives the trivial solution x=y=0x=y=0x=y=0. To seek a nontrivial solution, one can continue from (x0,y0)=(1,0)(x_0,y_0)=(1,0)(x0​,y0​)=(1,0).

Refining the approximation: modulo 999

Set x0=1x_0=1x0​=1 and write

x=1+3x1+terms divisible by 9.x=1+3x_1+\text{terms divisible by }9.x=1+3x1​+terms divisible by 9.

Modulo 999, all later terms vanish. Expanding the powers in the equation and reducing modulo 999 yields

3+15x1≡0(mod9).3+15x_1\equiv 0\pmod{9}.3+15x1​≡0(mod9).

If x1=1x_1=1x1​=1, the left side is 181818, a multiple of 999. Therefore x1=1x_1=1x1​=1 works, and the beginning of the expansion is

x=1+3+terms divisible by 9.x=1+3+\text{terms divisible by }9.x=1+3+terms divisible by 9.

At this stage, the terms involving yyy do not determine its next coefficient: squaring a quantity that already has a factor of 333 makes the result divisible by 999.

A further refinement: modulo 272727

Now write

x=1+3+9x2+terms divisible by 27.x=1+3+9x_2+\text{terms divisible by }27.x=1+3+9x2​+terms divisible by 27.

Using the known values x0=x1=1x_0=x_1=1x0​=x1​=1, expanding the equation modulo 272727 reduces the condition to

9+18x2≡0(mod27).9+18x_2\equiv 0\pmod{27}.9+18x2​≡0(mod27).

Taking x2=1x_2=1x2​=1 makes the left side 272727, so x2=1x_2=1x2​=1 works. Continuing with moduli 818181, 243243243, and higher powers of 333 gives further digits. In this example, the successive coefficients are all 111, leading to the 3-adic expansion

x=1+3+32+33+⋯ .x=1+3+3^2+3^3+\cdots.x=1+3+32+33+⋯.

This process of extending a solution modulo pkp^kpk to a solution modulo pk+1p^{k+1}pk+1 is an example of p-adic lifting, associated with Hensel’s method. Each stage refines the solution by one more base-ppp digit.


Why an apparently divergent series can have a p-adic sum

As a real-number series, the terms in

1+3+32+33+⋯1+3+3^2+3^3+\cdots1+3+32+33+⋯

grow rather than shrink, so the partial sums do not converge to a finite real number. In the 3-adic system, however, powers of 333 become smaller in p-adic size as their exponents increase. The series therefore converges 3-adically.

The geometric-series formula gives

1+r+r2+⋯=11−r1+r+r^2+\cdots=\frac{1}{1-r}1+r+r2+⋯=1−r1​

when the powers of rrr approach zero in the relevant notion of size. For the 3-adic absolute value, 333 has size 13\frac{1}{3}31​, so the formula applies with r=3r=3r=3:

1+3+32+33+⋯=11−3=−12.1+3+3^2+3^3+\cdots=\frac{1}{1-3}=-\frac{1}{2}.1+3+32+33+⋯=1−31​=−21​.

Thus the infinite 3-adic string of 111s represents the ordinary rational number −12-\frac{1}{2}−21​ when interpreted through the 3-adic embedding of the rationals.

Substituting x=−12x=-\frac{1}{2}x=−21​ into the sum-of-squares equation gives

x2+x4+x8=14+116+1256=81256=(916)2.x^2+x^4+x^8 =\frac{1}{4}+\frac{1}{16}+\frac{1}{256} =\frac{81}{256} =\left(\frac{9}{16}\right)^2.x2+x4+x8=41​+161​+2561​=25681​=(169​)2.

Therefore, y=916y=\frac{9}{16}y=169​ gives a rational solution. In the geometric interpretation, the side lengths are the magnitudes of xxx, x2x^2x2, and x4x^4x4: these are 12\frac{1}{2}21​, 14\frac{1}{4}41​, and 116\frac{1}{16}161​. Their square areas add to the area of a square with side length 916\frac{9}{16}169​.

The key point is that the same expansion can have different convergence behavior under different notions of distance. The series diverges as a real series but converges as a 3-adic series.


The p-adic notion of size and distance

Real numbers are commonly pictured on a line, where numbers are close when their difference is small in ordinary magnitude. P-adic numbers use a different geometry. Two p-adic numbers are close when their expansions agree for many initial digits, beginning at the units place.

For example, if two 3-adic expansions first differ in the coefficient of 3k3^k3k, their difference is divisible by 3k3^k3k. Their 3-adic distance has size

3−k.3^{-k}.3−k.

The more initial digits two numbers share, the smaller their p-adic distance. If they agree through many powers of 333, they are very close even if their ordinary real values appear far apart.

This reverses familiar intuitions about powers of 333:

  • In the real-number metric, higher powers such as 3103^{10}310 are very large.

  • In the 3-adic metric, a difference divisible by 3103^{10}310 is very small, with size 3−103^{-10}3−10.

A useful visualization is an infinite, branching tree. For 3-adic integers, the three initial branches correspond to the units digit 000, 111, or 222. Each branch then splits into three choices for the next digit, and this branching continues indefinitely. Two paths stay close together as long as they share the same initial digits; they separate at the first digit where they differ. Computing successive coefficients of a p-adic solution can therefore be understood as progressively refining the position of that solution.

The p-adic absolute value can be defined using the exponent of the largest power of ppp dividing a number. If vp(x)v_p(x)vp​(x) is that exponent, then for nonzero xxx,

∣x∣p=p−vp(x).|x|_p=p^{-v_p(x)}.∣x∣p​=p−vp​(x).

For instance, a number divisible by pkp^kpk has p-adic absolute value at most p−kp^{-k}p−k. Greater divisibility by ppp means smaller p-adic size.

An absolute value is expected to satisfy three main properties:

  • Positive definiteness: ∣x∣≥0|x|\geq 0∣x∣≥0, and ∣x∣=0|x|=0∣x∣=0 exactly when x=0x=0x=0.

  • Multiplicativity: ∣xy∣=∣x∣∣y∣|xy|=|x||y|∣xy∣=∣x∣∣y∣.

  • Triangle inequality: ∣x+y∣≤∣x∣+∣y∣|x+y|\leq |x|+|y|∣x+y∣≤∣x∣+∣y∣.

The usual real absolute value and the p-adic absolute values satisfy these conditions. There is also the trivial absolute value, which assigns 000 to 000 and 111 to every nonzero rational number. A central result about absolute values on the rational numbers says that, up to the appropriate notion of equivalence, these are the fundamental possibilities.


Why p-adic methods help with equations

The p-adic geometry of solutions is highly disconnected compared with the continuous geometry of the real numbers. Near a proposed p-adic solution, requiring more correct digits can sharply narrow the possibilities. This makes it practical to test and refine solutions one congruence at a time.

By contrast, real polynomial equations often have large continuous sets of nearby solutions. A strategy that tries to identify one precise solution by successively fixing individual digits may be overwhelmed by the many real solutions in the surrounding space.

P-adic methods are therefore valuable not merely because they define unusual numbers, but because their arithmetic and geometry can make certain equations easier to study. They provide tools for testing whether solutions exist, constructing solutions by lifting modular approximations, and understanding equations through their behavior modulo increasing powers of primes.


Fermat’s Last Theorem and the role of p-adics

The Pythagorean equation has integer solutions, but Fermat’s Last Theorem concerns the higher-power equation

xn+yn=zn.x^n+y^n=z^n.xn+yn=zn.

The theorem states that there are no nonzero integer solutions when n>2n>2n>2. Fermat famously asserted the result but did not provide a proof that was later accepted as complete. The theorem remained unproved for centuries, until Andrew Wiles, working in collaboration with Richard Taylor on part of the argument, proved it using modern mathematics that included p-adic methods.

A technique associated with the proof is called the 3–5 trick. The idea described is that an argument using the prime 333 works in many cases but can encounter an obstruction; switching to the prime 555 can then overcome that obstruction. Each prime gives its own p-adic system, with its own way of measuring size and structuring congruences.

The broader lesson is that p-adic numbers became important tools in number theory and related areas because they make prime-by-prime structure visible. They support methods that are difficult or impossible to express using only ordinary real-number intuition.

P-adic number systems and the real numbers provide different perspectives on arithmetic: the real absolute value emphasizes ordinary magnitude, while a p-adic absolute value emphasizes divisibility by a prime. Both perspectives reveal useful structure in equations.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent