Thursday, July 17, 2008

Digit Patterns in Square Numbers

If you take a look at the square numbers (n^2, n a positive integer), you'll notice plenty of patterns in the digits. For example, if you look at just the last digit of each square, you'll observe the repeating pattern 1, 4, 9, 6, 5, 6, 9, 4, 1, 0, ... If you construct a graph of "last digit" vs n (like the one below, built with Fathom), the symmetry and period of this digit pattern is apparent.

Why does this happen? The periodic nature of the pattern is easy to understand - when you square a number, only the digit in the ones place contributes to ones place of the product. For example, 22*22 and 32*32 are both going to have a 4 as their last digit - the values in the tens place (or any other place other than the ones) do not affect what ends up as the last digit.

The reason for the symmetry about n=5 is a little less obvious. To see what is going on, it is helpful to use modular arithmetic and to realize that " last digit of n" is the same as "n mod 10". Considering what 10-n looks like mod 10 after it is squared, we have the equation below.

This tells us that the last digit of (10-n)^2 is the same as the last digit of n^2, because everything else that is different about these two numbers is divisible by 10.

If you look at the last two digits of the square numbers, you see another repeating pattern that has similar symmetries.
This is a nice looking graph - the period is 50 with a line of symmetry at n=25. You can think about it in the same way as the one-digit case, this time the symmetry is understood by looking at (50-n)^2 mod 100. (Looking at numbers mod 100 tells us their last two digits.)

If you decide to investigate patterns in cubes or higher powers, you'll see somewhat similar results. Using the binomial theorem and modular arithmetic, you can see why even powers give symmetry similar to the n^2 case, while odd powers do not (although all are periodic).

This graph shows the pattern in the last digit of n^3.

This last graph shows the pattern for the last two digits of n^4.

2 comments:

  1. 1^2=1
    2^2=4 _3
    3^2=9 _5 +2 =7
    4^2=16 _7 +2 =9
    5^2=25 _9 +2 =11

    This addition of two continues forever.

    Upon further investigation there are many confusing and correlating data.

    For instance:
    2 divided by 5 = .40
    3 divided by 7 = .428
    4 divided by 9 = .444
    5 divided by 11 = .4545
    6 divided by 13 = .4615
    7 divided by 15 = .4666

    The percentage difference between these divisions is equally confusing.

    .40 grows to .428, or by .028
    .428 grows to .444, or by .016, 57% of previous growth.
    .444 grows to .4545, or by .010, 62% of previous growth.
    .4545 grows to .4615, or by .070, 700% of previous growth.
    .4615 grows to .4666, or by .051, 72.8% of previous growth.

    The pattern seems sporadic and unusual, but it also seems like a perfect candidate for equation-building. As with the above data, some areas see massive growth, or incredible reduction.

    Take care.

    ReplyDelete
  2. I noticed today that
    (1+X^2)=((1+X)^2)-2X

    OR in other words...
    When X is 5
    1+5^2 = 26
    (1+5)^2 = 36
    5+5 = 10
    36 - 10 = 26

    Its kinda hard to follow but pretty much if you know one square (lets stick with 25) you can find the next square by adding 1 and the sum of the square roots. You can also find the previous square by the sum of 1 and the numerical position of your current square. Example...

    36 is the 5th square number...
    5+5+1 = 11
    36-11 = 25

    25 is the 4th square...
    4+4+1 = 9
    25-9 = 16

    16 is the 3rd square.

    Figured it out driving down the road...

    ReplyDelete