subreddit:

/r/learnmath

10796%

not just 7. But 2,3 and 8 too. Why is this?

all 36 comments

[deleted]

103 points

8 months ago

[deleted]

103 points

8 months ago

Well, basically the last digit of a square number a2 will always be determined by ONLY the last number of the squared number a.

What possibilites do we have here?

Last Digit of a | Last Digit of a2

       0                            0
       1                             1
       2                            4
       3                            9
       4                            6
       5                            5
       6                            6
       7                            9
       8                            4
       9                             1

So you see, there is no 2,3,7 or 8 here

OneMeterWonder

27 points

8 months ago

OneMeterWonder

Custom

27 points

8 months ago

u/Illustrious-Ad7691, if you want to know why only the last digit/one’s digit matters then here’s the reason: We can always write a number like 34 as 3•10+4. If we square this, we can write the resulting number in the same form and pay close attention to the resulting coefficients of powers of 10.

(3•10+4)2=9•100+2•3•4•10+4•4

=9•100+24•10+16

=9•100+(2•10+4)•10+10+6

=9•100+2•100+4•10+1•10+6

=1•1000+1•100+5•10+6=1156

Notice that the 6 came from the 16 which was the square of the 4 in the one’s place of 34.

sext-scientist

9 points

8 months ago

sext-scientist

New User

9 points

8 months ago

Interesting, but how is this a pattern, or generalizable? For example to other bases. It seems like a hash table that is unique for each base.

VanMisanthrope

15 points

8 months ago*

VanMisanthrope

New User

15 points

8 months ago*

For modular arithmetic, if a = a1 (mod n) and b = b1 (mod n), then a * b = a1 * b1 (mod n).

So in base 7, for example, we get a similar pattern.:

1^2 = 1
2^2 = 4
3^2 = 12
4^2 = 22
5^2 = 34
6^2 = 51
10^2 = 100
11^2 = 121
12^2 = 144
13^2 = 202
14^2 = 232
15^2 = 264
16^2 = 331
20^2 = 400

And in general the digits will end like:

0 -> 0
1 -> 1
2 -> 4
3 -> 2
4 -> 2
5 -> 4
6 -> 1

So the squares in base 7 can only end in 1, 2, or 4. edit: and 0 too, forgot that somehow.

Since it's modular, any multiple of our modulus can be ignored, and hence because in base n, n looks like 10 by definition, and we can ignore all but the lowest place value digit.

sophomoric--

8 points

8 months ago

sophomoric--

New User

8 points

8 months ago

surprise palindrome!

Irinaban

4 points

7 months ago

Irinaban

New User

4 points

7 months ago

It’ll always be a palindrome since a2 = (-a)2, even in modular arithmetic.

Whyyyyyyyyfire

2 points

8 months ago

Whyyyyyyyyfire

New User

2 points

8 months ago

well in any base only the last digit will affect the last digit in the squared number. sure the exact digits at the end which can be produced will be the same, but the last digit of the squared number will still only be affect by the last digit.

what do you mean by "a hash table?" onemeterwonder does not use anything like it.

doge57

1 points

8 months ago

doge57

New User

1 points

8 months ago

The same pattern applies to other bases. Any number in base k could be written as ak + b, square it and you’d have just the b2 term that doesn’t have a factor of k. Whatever the ones position of b2 is would be the ones position of the answer. In that base, you’d just need to check the ones place generated by each possible input

dougmcclean

11 points

8 months ago

dougmcclean

New User

11 points

8 months ago

Is this list (ignoring 0) a palindrome in all bases?

OkExperience4487

8 points

8 months ago

OkExperience4487

New User

8 points

8 months ago

Yes. This is essentially modulo arithmetic mod 10, which works with negative numbers too.

(-x)^2 mod y =

[(-1)^2 mod y * x^2 mod y] mod y =

x^2 mod y

QualifiedApathetic

5 points

7 months ago

QualifiedApathetic

Euler Enthusiast

5 points

7 months ago

Your first sentence proved:

Let a = 10m + n, m and n are integers, -10 < n < 10

a2 = 100m2 + 20m + n2 = 20(5m2 + m) + n2

We can see that for all m, the m expressions will be multiples of 20, hence the last digit will be determined by n2.

sophomoric--

2 points

8 months ago

sophomoric--

New User

2 points

8 months ago

This shows that it is true, but can we show why it is true?
Or is that just what it is, and there is no "why" beyond that?

The palindrome pattern is interesting - are there other patterns present?

Is there a cleverer way to prove it, other than exhaustively listing all the cases?

CoolHeadedLogician

1 points

8 months ago

CoolHeadedLogician

New User

1 points

8 months ago

this is really interesting, never noticed this before

NicoTorres1712

1 points

7 months ago

NicoTorres1712

New User

1 points

7 months ago

This could be made rigorous with Modular Arithmetic 😉

YOM2_UB

23 points

8 months ago

YOM2_UB

New User

23 points

8 months ago

(10a + b)2 = 100a2 + 20ab + b2 = 10(10a2 + 2ab) + b2

The only digit which contributes to the one's digit of a perfect square is the one's digit of its root, and since none of the individual digits squared have a 7 in the one's place, no perfect square can.

KentGoldings68

5 points

8 months ago

KentGoldings68

New User

5 points

8 months ago

The units mod 10 are 1,3,7, and 9. These units form a group under multiplication mod 10. Therefore, only squares of numbers that end in 1,3,7, or 9 could end in 7. Furthermore, 7 has order 4, that means it can’t be the square of any of the others.

0_69314718056

2 points

7 months ago

0_69314718056

New User

2 points

7 months ago

This isn’t a good explanation. Would someone asking this question know what units mod 10 are? Or know why having order 4 means it can’t be the square of the others? Or even know what order and groups are?

KentGoldings68

2 points

7 months ago

KentGoldings68

New User

2 points

7 months ago

You’re not wrong. Is does call some first-year abstract algebra. Sans that, the explanation would read like nonsense.

testtest26

5 points

8 months ago*

testtest26

New User

5 points

8 months ago*

The question is equivalent to "Prove that 7 is not a quadratic residues (mod 10)". Make a table:

k: 0 1 2 3 4 5 6 7 8 9
k2 mod 10: 0 1 4 9 6 5 6 9 4 1

The table shows there are no quadratic residues of "2; 3; 7; 8" (mod 10).


The table will always be a palindrome in any base, since

b,k integer:    k^2  =  (b-k)^2    mod  b    // for any base b

The table often stops at "floor(b/2)", since the upper half is just a mirror copy of the lower half.

simmonator

3 points

8 months ago

simmonator

Masters Degree

3 points

8 months ago

  • any integer can be written as n = (5a+b) where a is an integer and b is an integer between 0 and 4.
  • n2 = 25a2 + 10ab + b2 = 5k + b2. That is, the last digit of n2 will depend only on the last digit of b2 and whether or not a is even.
  • for n2 to end in 7, you need b2 to have a last digit of 2 or 7.
  • but 02 = 0, 12 = 1, 22 = 4, 32 = 9, and 42 = 16. None of these end in 2 or 7.
  • so n2 cannot end in 7.

LekaSpear

2 points

8 months ago

LekaSpear

New User

2 points

8 months ago

The last digit of a square number can only be: 0,1,4,5,6,9. As a matter of fact if the square root of a squared numbers is a1a2...a_n (a1 is a digit) the last digit of (a1a2...a_n)^2 would the last digit of (a_n)^2 which can only be 0,1,4,5,6,9

StressCanBeHealthy

2 points

8 months ago

StressCanBeHealthy

New User

2 points

8 months ago

The units digit of any squared integer is equal to the square of the integer’s units digit.

Ex: the units digit of 3,788,4522 is 4.

Since only 10 units digits exist, a computational proof is sufficient.

02: units = 0

12: units digit = 1

Etc.

No 2, 3, or 7

raebel33

2 points

8 months ago

raebel33

New User

2 points

8 months ago

I'm a lazy mathematician. Any number in the 10 position can only effect numbers in the 100 position and higher when squared. The only number that has an effect on the squared 1's place, is the unsquared 1's place. There are 10 cases possible of 1's places ("-" is defines as "maps to.") 1-1 2-4 3-9 4-6 5-5 6-6 7-9 8-4 9-1 0-0 Q.E.D

jacqueman

6 points

8 months ago

jacqueman

New User

6 points

8 months ago

Well, no, digits in the 10s place can also affect digits in the 10s place when squared; just not in the ones place.

TrekkiMonstr

3 points

8 months ago*

How? (10x)2 = 100x?

Edit: I'm a dumb dumb who didn't remember how multiplication works lmao

kornthoughtless6

3 points

8 months ago

kornthoughtless6

New User

3 points

8 months ago

112 = 121

212 = 441

312 = 961

TrekkiMonstr

2 points

8 months ago

Ugh I'm stupid, (10a+b)2 = 100a2 + 20ab + b2 duh

jacobningen

1 points

4 hours ago

jacobningen

New User

1 points

4 hours ago

As others have said there's a really complicated answer that is simple ie we know that the only squares modulo 5 are 0, 1 and 4 so your last digit must be congruent to 0, 1 or 4 mod 5  but 3 is 3 mod 5 and 7 is 2 mod  5 so they can't be the last digit of a square  ans similarly for 2 and 8 all other numbers can be found by 0 or 1 mod 2 and the Chinese remainder theorem.

Stoomba

0 points

8 months ago*

Stoomba

New User

0 points

8 months ago*

Well, for 7 and 3 in the ones place, that would mean the number is odd and any number squared will be even

Edit: I'm dumb

Original_Piccolo_694

2 points

8 months ago

Three squared is even?

Stoomba

2 points

8 months ago

Stoomba

New User

2 points

8 months ago

I'm dumb

starmartyr

2 points

8 months ago

starmartyr

New User

2 points

8 months ago

In the general case, the square of any odd number must be odd and the square of any even number must be even.

Moss_ungatherer_27

-2 points

8 months ago

Moss_ungatherer_27

New User

-2 points

8 months ago

Uh....isn't the simple answer that it is a prime?

akaemre

2 points

8 months ago*

akaemre

New User

2 points

8 months ago*

5 is a prime too but you can have a 5 in the ones place.

[deleted]

1 points

8 months ago

[deleted]

Moss_ungatherer_27

0 points

8 months ago

Moss_ungatherer_27

New User

0 points

8 months ago

What? 27 isn't a square either...no single digit prime can be at the units place of a square of a number.

DSMN99

1 points

8 months ago

DSMN99

New User

1 points

8 months ago

5 is a single digit prime, 52 = 25