All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Get the last digit II (Posted on 2011-02-23) Difficulty: 3 of 5
Let A=1^n+2^n+3^n+...9^n

For a positive integer n what is
the last digit of A?

No Solution Yet Submitted by Ady TZIDON    
Rating: 4.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution | Comment 2 of 4 |

Each of the individual power terms has a cycle length of 1, 2 or 4, so the overall cycle length must be one of these, and is in fact 4 as shown below:

                      i^n mod 10
n         i = 1  2  3  4  5  6  7  8  9  A mod 10
1             1  2  3  4  5  6  7  8  9   5
2             1  4  9  6  5  6  9  4  1   5
3             1  8  7  4  5  6  3  2  9   5
4             1  6  1  6  5  6  1  6  1   3
5             1  2  3  4  5  6  7  8  9   5
6             1  4  9  6  5  6  9  4  1   5
7             1  8  7  4  5  6  3  2  9   5
8             1  6  1  6  5  6  1  6  1   3
9             1  2  3  4  5  6  7  8  9   5
10            1  4  9  6  5  6  9  4  1   5
11            1  8  7  4  5  6  3  2  9   5
12            1  6  1  6  5  6  1  6  1   3
13            1  2  3  4  5  6  7  8  9   5
14            1  4  9  6  5  6  9  4  1   5
15            1  8  7  4  5  6  3  2  9   5
16            1  6  1  6  5  6  1  6  1   3
17            1  2  3  4  5  6  7  8  9   5
18            1  4  9  6  5  6  9  4  1   5
19            1  8  7  4  5  6  3  2  9   5
20            1  6  1  6  5  6  1  6  1   3
21            1  2  3  4  5  6  7  8  9   5
22            1  4  9  6  5  6  9  4  1   5
23            1  8  7  4  5  6  3  2  9   5
24            1  6  1  6  5  6  1  6  1   3
25            1  2  3  4  5  6  7  8  9   5

The above table was produced with

v1 = 1
v2 = 2
v3 = 3
v4 = 4
v5 = 5
v6 = 6
v7 = 7
v8 = 8
v9 = 9

CLS
FOR n = 1 TO 25
  PRINT n,
  PRINT v1 MOD 10;
  PRINT v2 MOD 10;
  PRINT v3 MOD 10;
  PRINT v4 MOD 10;
  PRINT v5 MOD 10;
  PRINT v6 MOD 10;
  PRINT v7 MOD 10;
  PRINT v8 MOD 10;
  PRINT v9 MOD 10,
  PRINT (v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9) MOD 10

  v1 = v1 * 1 MOD 10
  v2 = v2 * 2 MOD 10
  v3 = v3 * 3 MOD 10
  v4 = v4 * 4 MOD 10
  v5 = v5 * 5 MOD 10
  v6 = v6 * 6 MOD 10
  v7 = v7 * 7 MOD 10
  v8 = v8 * 8 MOD 10
  v9 = v9 * 9 MOD 10
NEXT

So, when n is a multiple of 4, A = 3, otherwise A = 5.

That can be turned into an explicit formula:

A = 3 - 2*[[n/4]-n/4]

where [x] = largest integer smaller than x, i.e., the FLOOR function, so that, for example, [-.25] = -1.


  Posted by Charlie on 2011-02-23 20:57:50
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (12)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information