News for hackers. Stuff that matters.
Re:Why is the last digit of n^5 equal to the last digit of n... by panda88888 on Friday October 27, 2017 @06:51PM (#15572867)
At work so I haven’t watched the video yet, but my quick rationale is,

Let m = abs(n) It follows n = sign(n) * m We can work with m since sign(n) doesn’t affect the ones digit of n^5. More formally, n^5 = sign(n)^5 * abs(n)^5.

Let m = 10 * b + a, where b = floor(m/10) a = m % 10

Essentially we extract the ones digit as a.

m^5 = (10 * b + a)^5 If we expand the terms, only a^5 affects the ones digit. The remaining has at least one 10 as factor.

Quick python script will verify a^5 has a as the ones digit for 0...9.

  for a in range(10):
      print(pow(a, 5) == a) 
Edit: fixed formatting
Re:Why is the last digit of n^5 equal to the last digit of n... by contravariant on Friday October 27, 2017 @07:45PM (#15573158)
There are some slight problems with your proof, firstly your proof doesn't really use the fact that you're raising a number to the 5th power, except for the last part and secondly the last part (as it is currently written) will print "false" for all numbers other than 1.

Also I don't think you need to bother with the sign of the number. Python is one of the few languages that took the sensible approach and made statements like (a % 10 = (a + 10) % 10) true for all a.

Re:Why is the last digit of n^5 equal to the last digit of n... by iamzlatan on Friday October 27, 2017 @06:59PM (#15572918)
It's not exactly the same thing as he does in the video but it's also an interesting approach. Also in the video he assumes n is natural so no need to use sign(n).