Pattern involving squares, primes, and remainders

108 Views Asked by At

I ran across a really neat pattern, wholly by accident.

In advance, my questions are:

  1. Has this been discovered before? If so, where can I learn more about it?
  2. Why does this pattern work?

Now for the pattern...


We'll use the number $7$ to show the pattern, but I've found this works for any prime:

Beginning at $1$, we count up, pairing each number with $7$ minus that number:

1,6
2,5
3,4
4,3
5,2
6,1
7,0

Now, we'll take that list and write the products of these as well:

1,6  6
2,5  10
3,4  12
4,3  12
5,2  10
6,1  6
7,0  0

Then we take the remainders of these when divided by $7$:

1,6  6   6
2,5  10  3
3,4  12  5
4,3  12  5
5,2  10  3
6,1  6   6
7,0  0   0

Then subract these from $7$:

1,6  6   6  1
2,5  10  3  4
3,4  12  5  2
4,3  12  5  2
5,2  10  3  4
6,1  6   6  1
7,0  0   0  0 (7 is 0 mod 7)

Ok, now look at a listing of the squares:

1x1  1
2x2  4
3x3  9
4x4  16
5x5  25
6x6  36
7x7  49

And their remainders when divided by $7$:

1x1  1   1
2x2  4   4
3x3  9   2
4x4  16  2
5x5  25  4
6x6  36  1
7x7  49  0

Then this last column appended to our other list:

1,6  6   6  1  1
2,5  10  3  4  4
3,4  12  5  2  2
4,3  12  5  2  2
5,2  10  3  4  4
6,1  6   6  1  1
7,0  0   0  0  0

They're the same! This pattern continues to repeat as we climb through the squares and holds for all primes! So, when we take the squares and divide them by a prime, half it's remainders are impossible, with the other half repeating in a pattern! I see some of what's going on here, but not everything.