Chữ số hàng đơn vị của 2024 2022

Như bạn có thể thấy, sức mạnh tăng lên nhanh chóng. Vì vậy, thật hữu ích khi nhận thấy rằng chúng ta chỉ cần xem xét chữ số hàng đơn vị khi đánh giá các lũy thừa lớn. Ví dụ: chữ số hàng đơn vị của 132 bằng chữ số hàng đơn vị của 32, chữ số hàng đơn vị của 135 bằng chữ số hàng đơn vị của 35, v.v.

Tiếp tục, ta được

131 có chữ số hàng đơn vị là 3

132 có chữ số hàng đơn vị là 9

133 có chữ số hàng đơn vị là 7

134 có chữ số hàng đơn vị là 1

135 có chữ số hàng đơn vị là 3

136 có chữ số hàng đơn vị là 9

137 có chữ số hàng đơn vị là 7

138 có chữ số hàng đơn vị là 1

Lưu ý rằng một mô hình đẹp xuất hiện. Chúng tôi nhận được. 3-9-7-1-3-9-7-1-3-9-7-1-…

Như bạn có thể thấy, mô hình lặp lại sau mỗi 4 lũy thừa. Tôi muốn nói rằng "chu kỳ" bằng 4

Bây giờ chúng ta biết chu kỳ là 4, chúng ta có thể thực hiện một quan sát rất quan trọng

Khi n là bội số của 4 thì chữ số hàng đơn vị của 13n là 1

Đó là,

134 có chữ số hàng đơn vị là 1

138 có chữ số hàng đơn vị là 1

1312 có chữ số hàng đơn vị là 1

1316 có chữ số hàng đơn vị là 1

. . vân vân

Lúc này ta tìm được chữ số hàng đơn vị của 1335

Vì 32 là bội của 4 nên 1332 phải có chữ số hàng đơn vị là 1. Từ đây, chúng ta sẽ tiếp tục mô hình

Hệ thống số là một phương pháp biểu diễn các số trên dòng số với sự trợ giúp của một tập hợp các ký hiệu và quy tắc. Các ký hiệu này nằm trong khoảng từ 0-9 và được gọi là chữ số. Hệ thống Số được sử dụng để thực hiện các phép tính toán học, từ các phép tính khoa học tuyệt vời đến các phép tính như đếm số lượng Đồ chơi cho Trẻ em hoặc số lượng sôcôla còn lại trong hộp. Hệ thống số bao gồm nhiều loại dựa trên giá trị cơ bản cho các chữ số của chúng

Chu kỳ của các số. Chu kỳ của bất kỳ số nào chủ yếu tập trung vào chữ số hàng đơn vị của nó. Mỗi chữ số hàng đơn vị có kiểu lặp lại riêng khi nâng lên bất kỳ lũy thừa nào. Khái niệm này được sử dụng rất nhiều trong khi giải các bài toán năng khiếu. Khái niệm về chu kỳ của các số có thể được học bằng cách tìm ra các chữ số hàng đơn vị của tất cả các số có một chữ số từ 0 đến 9 khi được nâng lên các lũy thừa nhất định. Những con số này có thể được phân loại thành ba loại được liệt kê như sau

1. Các chữ số 0, 1, 5 và 6. Ở đây, khi mỗi chữ số này được nâng lên một lũy thừa bất kỳ, thì chữ số hàng đơn vị của đáp án cuối cùng chính là số đó

ví dụ

1. 5 ^ 2 = 25: Unit digit is 5, the number itself.
2. 1 ^ 6 = 1: Unit digit is 1, the number itself.
3. 0 ^ 4 = 0: Unit digit is 0, the number itself.
4. 6 ^ 3 = 216: Unit digit is 6, the number itself.

Dưới đây là một số câu hỏi dựa trên khái niệm trên

Câu hỏi 1. Tìm chữ số hàng đơn vị của 416345

Trả lời. Chỉ cần tìm 6345 sẽ cho 6 là chữ số hàng đơn vị, do đó chữ số hàng đơn vị của 416345 là 6

Câu hỏi 2. Tìm chữ số hàng đơn vị của 23534566

Trả lời. Tìm 534566 biết chữ số hàng đơn vị là 5 nên chữ số hàng đơn vị của 23534566 là 5

2. Chữ số 4 và 9. Cả hai chữ số 4 và 9 này đều có tích hai chữ số khác nhau là chữ số hàng đơn vị

ví dụ

1. 4 ^ 2 = 16: Unit digit is 6.
2. 4 ^ 3 = 64: Unit digit is 4.
3. 4 ^ 4 = 256: Unit digit is 6.
4. 4 ^ 5 = 1024: Unit digit is 4.
5. 9 ^ 2 = 81: Unit digit is 1.
6. 9 ^ 3 = 729: Unit digit is 9.

Có thể nhận thấy các chữ số hàng đơn vị 2, 4, 8, 6 lặp lại sau khoảng thời gian bốn số. Tương tự,

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
3
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
4
6
4
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
6

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
8

 

6
1
3
0
3
1

3
2

 

3
3

6
4
3
5

3
6

3
7_______10_______8

3
7_______10_______0
2
6
1

3
2

Java




2
6
3

2
6
4

2
6
5
2
6
6

 

2
6
7
2
6
8

6
1// Efficient C++ program to0

6
1// Efficient C++ program to2
6
4
6
5
6
4
6
7
6
4
6
9

6
1
6
0

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
2

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
4

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
4 // find unit digit of x^y.7// find unit digit of x^y.8// find unit digit of x^y.9

6
1

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
9

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
1

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
3
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
4
6
4 #include 9using0using1

using2_______722_______3using4// find unit digit of x^y.9

6
1

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
3
0
3
1

6
1
3
2

6
1

6
1
3
3

6
1
6
06 // Efficient C++ program to2
6
08
6
09
6
10
6
11

6
1
6
0

6
1
6
15
6
16
6
17
6
18
6
19

6
1
3
2

3
2

 

6
23

Python3




6
24

6
25

 

6
26

6
27

6
28
6
29

 

6
1
6
31

6
1_______2_______33

6
1
6
35
6
36 // find unit digit of x^y.8

6
1

6
1
6
40

6
1
6
42

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
3
6
45_______2_______46
6
47
6
48

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
35_______2_______36
6
52_______2_______53
6
54
6
55 using4

6
1

6
1
3
0
6
35

6
1

6
62

6
63
6
64
6
16
6
17
6
18
6
68

 

 

6
69

C#




2
6
3

2
6
4

using

6
73

 

2
6
7
6
75

6
0

6
1// Efficient C++ program to0

6
1// Efficient C++ program to2
6
4
6
5
6
4
6
7
6
4
6
9

6
1
6
0

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
2

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
4

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
4
6
7

6
1

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
9

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
1

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
3
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
4
6
4
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
6

using2______3_______8

6
1

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
3
0
3
1

6
1
3
2

6
1

6
1
3
3

6
1
6
06 // Efficient C++ program to2
6
08
6
21

6
1
6
0

6
1
6
25

6
1
3
2

3
2

 

6
29

PHP




6
30

6
31

// find unit digit of x^y.

 

6
2

6
3

6
35
6
5_______2_______37
6
17
6
39
6
40

6
0

6
1
6
2

6
1
6
4

6
1_______2_______47
6
48

 

6
1
6
9

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
1

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
3
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
4
6
56
6
57
6
56
6
59
6
39// find unit digit of x^y.9
6
56
6
63

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
47
6
66
6
47
6
53
6
37
6
70

 

6
1
3
0
6
47// find unit digit of x^y.9

3
2

 

6
76

6
77
6
78

 

6
79

6
80

Javascript




6
81

 

6
82

// find unit digit of x^y.

 

6
2

6
3

6
35
6
87

6
0

6
1

6
1
6
2

6
1
6
4

6
1_______2_______95

 

6
1
6
9

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
1

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
3
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
02

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
8

 

6
1
3
0
3
1

3
2

 

6
76

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
10

 

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
11

 

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
12

Đầu ra

6

đầu ra.  

6

Thời gian phức tạp. O(y), trong đó y là lũy thừa
Không gian phụ trợ. O(1), vì không cần thêm dung lượng
Tối ưu hóa hơn nữa. Chúng ta có thể tính toán sức mạnh mô-đun trong Log y

Cách 3 (Trực tiếp dựa trên tính chất tuần hoàn của chữ số cuối cùng)
Phương pháp này phụ thuộc vào chu kỳ với chữ số tận cùng của x là

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 

Vì vậy, ở đây chúng tôi trực tiếp sửa đổi lũy thừa y bằng 4 vì đây là lũy thừa cuối cùng sau khi bắt đầu lặp lại tất cả các số này
sau đó, chúng ta chỉ cần cấp nguồn cho số x chữ số cuối cùng, sau đó chúng ta nhận được chữ số hàng đơn vị của số được sản xuất.  

C++




x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
13

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
14

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
15

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
16

using

6
0
6
1

 

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
20

6
4
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
22_______2_______4
6
7
6
4
6
9

6
0

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
29

6
1_______3_______31

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
32

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
34

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
36
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
37

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
39

 

6
1_______3_______41

6
1_______3_______43

6
1_______3_______45

6
1
3
0
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
48_______2_______4
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
50
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
51
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
52

3
2

 

6
4
3
5

6
0

6
1
6
4
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
59

6
1

6
1____3_______62

6
1____3_______64

6
1____3_______66

6
1____3_______68

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
69

6
1
3
0
2
6
1

3
2

Java




x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
74

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
75

2
6
5
2
6
6

2
6
5
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
79

 

2
6
7
2
6
8

6
1

6
1_______3_______20

6
1// Efficient C++ program to2
6
4
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
22
6
4
6
7
6
4
6
9

6
1
6
0

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
29

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
98using4// find unit digit of x^y.9

using2

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
34

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
36
3
06using0
6
40

3
09_______10_______10
6
16
3
12
6
16// find unit digit of x^y.9

6
1

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
41

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
43

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
45

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
3
0
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
48
6
4
3
26using4
3
28

6
1
3
2

6
1

6
1

6
1
6
06 // Efficient C++ program to2
6
08
3
37

6
1
6
0

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
4
3
42
3
43
3
44
3
45// find unit digit of x^y.9

6
1

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
62

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
3
51

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
66

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
3
55

6
1

6
1
3
2

3
2

 

3
60

Python3




3
61

3
62

2
6
5
3
64

 

3
65

6
28
3
67

 

6
1
3
69

6
1
3
71
6
36
3
71____2_______55 using4

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7

6
1
3
78

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
36
3
81
6
36using0
3
84

3
85
3
86
6
36
3
86
6
55
6
16
3
12
6
16

 

6
1
3
94

6
1
3
96

6
1
3
98

6
1
3
0
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
48_______2_______4
2
6
03
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
51
2
6
05
6
55 using4
6
40

 

 

2
6
09

3
71
6
36
3
43
2
6
13
6
36
3
45

6
1

2
6
17

2
6
18

2
6
19

6
63
2
6
21

 

 

2
6
22

C#




2
6
23

2
6
24

using

6
73

 

2
6
7
2
6
8

6
1

6
1_______3_______20

6
1// Efficient C++ program to2
6
4
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
22
6
4
6
7
6
4
6
9

6
1
6
0

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
29

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
31

using2

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
34

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
36
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
37

3
09______3_______39

6
1

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
41

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
43

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
45

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
3
0
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
48
6
4
2
6
65

6
1
3
2

6
1

6
1
2
6
70

6
1
6
06 // Efficient C++ program to2
6
08
2
6
75

6
1
6
0

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
4
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
59

6
1

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
62

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
3
51

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
66

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
2
6
89

6
1

6
1
3
2

3
2

 

6
29

PHP




6
30

2
6
96

2
6
24

 

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
20

6
35
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
22
6
37
6
17_______2_______39
6
40

6
0

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
29

6
1
6
37
6
36
6
37 // Efficient C++ program to12

6
1

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
34

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
36
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
4
6
39// Efficient C++ program to20

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
39
6
36
6
39 // Efficient C++ program to25

 

6
1_______3_______41

6
1_______3_______43

6
1_______3_______45

6
1
3
0 // Efficient C++ program to34
6
37
6
17
6
39// Efficient C++ program to38

3
2

 

2
6
70

6
37 // Efficient C++ program to42
6
39 // Efficient C++ program to44

6
1

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
62

3
51

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
66

6
77// Efficient C++ program to50
6
37
6
17
6
39
6
19

 

6
79

6
80

Javascript




6
81

 

// Efficient C++ program to58

2
6
24

 

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
20

6
35 // Efficient C++ program to62

6
0

6
1

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
29

6
1_______3_______31

6
1

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
34

6
1_______3_______36 // Efficient C++ program to74

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
39

 

6
1_______3_______41

6
1_______3_______43

6
1_______3_______45

6
1
3
0 // Efficient C++ program to85

3
2

 

2
6
70

// Efficient C++ program to88

// Efficient C++ program to89

6
1

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
62

3
51

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
66

// Efficient C++ program to94

 

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
11

 

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
12

Đầu ra

3

Thời gian phức tạp. O(log n)
Không gian phụ trợ. Ô(1)

Tiếp cận. Phương pháp khai triển nhị thức

Sau đây là các bước tìm chữ số hàng đơn vị của x lũy thừa y bằng phương pháp Khai triển nhị thức

1. Xử lý các trường hợp đặc biệt

Nếu y bằng 0, trả về 1 vì bất kỳ số nào được nâng lên lũy thừa 0 đều bằng 1
Nếu x là 0, trả về 0 vì bất kỳ số nào lũy thừa 0 đều là 1 và chữ số hàng đơn vị của 0 là 0

2. Tính số hạng thứ y trong khai triển của (x+10)^y sử dụng định lý nhị thức

Thuật ngữ thứ y trong khai triển được cho bởi. C(y, 0)x^y10^0 + C(y, 1)*x^(y-1)*10^1 + … + C(y, y)x^010^y
Ở đây, C(y, k) đại diện cho hệ số nhị thức, bằng với y. / (k. * (y-k). )
Ta chỉ cần tính số hạng cuối cùng trong khai triển này là C(y, y)x^010^y

3. Tìm chữ số hàng đơn vị của số hạng thứ y

Chữ số hàng đơn vị của số hạng thứ y bằng chữ số tận cùng của số hạng thứ y
Chúng ta có thể tìm chữ số tận cùng của số hạng thứ y bằng cách lấy phần còn lại của số hạng đó khi chia cho 10

4. Trả về chữ số hàng đơn vị tìm được ở bước 3 là kết quả

C++




// Efficient C++ program to97

// Efficient C++ program to98

using

6
0
6
1

 

6
4 // find unit digit of x^y.03
6
4
6
7
6
4 // find unit digit of x^y.07

6
1_______3_______36 // find unit digit of x^y.10

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
3
0 // find unit digit of x^y.13

6
1
3
2

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
36 // find unit digit of x^y.18

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
3
0
2
6
1

6
1
3
2

6
1
6
4 // find unit digit of x^y.26
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
51_______718_______28

6
1
6
4 // find unit digit of x^y.31

6
1
3
0 // find unit digit of x^y.34

3
2

 

6
4 // find unit digit of x^y.37

6
1// find unit digit of x^y.39// find unit digit of x^y.40

6
1// find unit digit of x^y.42// find unit digit of x^y.43

6
1
3
0
2
6
1

3
2

// find unit digit of x^y.48

Java




2
6
5 // find unit digit of x^y.50

 

6
06
2
6
7 // find unit digit of x^y.53

6
1
6
06 // Efficient C++ program to2
6
4 // find unit digit of x^y.58
6
4
6
7
6
4 // find unit digit of x^y.07

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
36 // find unit digit of x^y.65using0// find unit digit of x^y.67

using2_______10_______0 // find unit digit of x^y.8// find unit digit of x^y.9

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
3
2

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
36 // find unit digit of x^y.76using0// find unit digit of x^y.67

using2_______10_______0 using0// find unit digit of x^y.9

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
3
2

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
4 // find unit digit of x^y.87
6
4_______718_______89using4// find unit digit of x^y.91

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
6
4 // find unit digit of x^y.94using4// find unit digit of x^y.9

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
3
0 // find unit digit of x^y.99

6
1
3
2

 

6
1
6
06 // Efficient C++ program to2
6
08 #include 06

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7#include 08
6
18
6
17// find unit digit of x^y.8
6
19// find unit digit of x^y.40

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7#include 08
6
16
6
17
6
18
6
19// find unit digit of x^y.43

6
1
3
2

3
2

Python3




6
28 #include 25

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
36
3
86
6
36_______2_______36 using0
3
84

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
3
0 // find unit digit of x^y.8

6
1
x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
36
3
71
6
36
6
36 using0
3
84

x   |  power 2  |  power 3  |   power 4  | Cyclicity  
0   | ................................. |  ... repeat with 0
1   | ................................. |  ... repeat with 1
2   |     4     |     8     |      6     | ... repeat with 2
3   |     9     |     7     |      1     | ... repeat with 3
4   |     6     |...................... |  ... repeat with 4
5   | ................................. |  ... repeat with 5
6   | ................................. |  ... repeat with 6
7   |     9     |     3     |      1     | ... repeat with 7
8   |     4     |     2     |      6     | ... repeat with 8
9   |     1     | ..................... |  ... repeat with 9 
7
3
0 using0

6
1#include 47
6
36 #include 49
3
12using4
6
40
6
53
6
53
3
86

Chữ số hàng đơn vị của 1 1 2 2 3 3 4 4 5 5 6 6 là bao nhiêu?

Trả lời. Chữ số hàng đơn vị của tổng biểu thức đã cho là 9 .

Chữ số hàng đơn vị của 3 2023 là bao nhiêu?

Chữ số hàng đơn vị cho 3^(4n+k) cho n bất kỳ số nguyên nào sẽ là 3 cho k=0, 9 cho k=1, 7 cho k=2 & 1 cho k=3. Power 2023 có thể được viết là 4*500 + 3, tức là n= 500 & k=3. Khi đó chữ số hàng đơn vị của 3^2023 là 1 (vì k=3).

Chữ số hàng đơn vị của 34 52 27 23 36 12 là bao nhiêu?

Vậy chữ số hàng đơn vị là 8 .

Chữ số ở hàng đơn vị của 2017 2017 là bao nhiêu?

vậy chữ số hàng đơn vị là 7 .