---
# System prepended metadata

title: "\U0001F522 Mastering Unit Digit Problems"

---

# 🔢 Mastering Unit Digit Problems

## The Problem

> **X** and **Y** are the digits at the unit's place of the numbers **(408X)** and **(789Y)** where **X ≠ Y**.  
> However, the digits at the unit's place of **(408X)^63** and **(789Y)^85** are the same.  
> **What will be the possible value(s) of (X + Y)?**

---

## 📚 Prerequisites

### 1. Base & Exponent

In the expression **2⁸** (read as "two raised to the power of 8"):
- **2** is the **base**
- **8** is the **exponent**

---

### 2. PEW — Power Ends With

**PEW** is a term we'll use to describe the **cyclical pattern** of unit digits when a number is raised to successive powers.

| Base | PEW (Power Ends With) | Meaning |
|:----:|:---------------------:|:--------|
| 1 | (1) | Any power of 1 ends in **1** |
| 2 | (2, 4, 8, 6) | Powers of 2 cycle through these digits |
| 3 | (3, 9, 7, 1) | Powers of 3 cycle through these digits |
| ... | ... | ... |

#### ⚠️ Important!
**PEW is an ordered sequence, not just a set.** The order matters because it tells us the *next* unit digit for consecutive powers.

**Example:** If 2¹⁰ = 1024 (ends in 4), then 2¹¹ ends in **8** (next in the cycle).

---

### 3. The Golden Property of PEW

> **To find the unit digit of a large number in base^exponent form, only consider the last digit of the base.**

| Expression | Simplifies To | Why? |
|:----------:|:-------------:|:-----|
| 12345678¹⁰⁴ | 8¹⁰⁴ | Only the unit digit (8) matters |
| 123456789¹²³ | 9¹²³ | Only the unit digit (9) matters |
| 408X⁶³ | X⁶³ | Only X determines the unit digit |

---

### 4. Modular Arithmetic

Think of **modulo** as finding the **remainder** after division.

> 🕐 **Real-world example:** Clocks use mod 12, so 13:00 becomes 1:00 PM.

| Expression | Value | Explanation |
|:----------:|:-----:|:------------|
| 1 mod 4 | 1 | 1 ÷ 4 = 0 remainder **1** |
| 5 mod 4 | 1 | 5 ÷ 4 = 1 remainder **1** |
| 8 mod 4 | 0 | 8 ÷ 4 = 2 remainder **0** |
| 100 mod 4 | 0 | Perfect division |

**Key insight:** `n mod X` always gives a value between **0** and **X-1**.

---

## 🔗 Connecting PEW and Modulo

Here's where the magic happens!

### Building the PEW Table for Base 2

| Power | Value | Unit Digit | Position in Cycle |
|:-----:|:-----:|:----------:|:-----------------:|
| 2¹ | 2 | 2 | 1st |
| 2² | 4 | 4 | 2nd |
| 2³ | 8 | 8 | 3rd |
| 2⁴ | 16 | 6 | 4th |
| 2⁵ | 32 | 2 | 1st ↩️ |
| 2⁶ | 64 | 4 | 2nd |
| 2⁷ | 128 | 8 | 3rd |
| 2⁸ | 256 | 6 | 4th |

**PEW(2) = (2, 4, 8, 6)** — cycle length = **4**

---

### 💡 The Formula

> **To find the unit digit of base^n:**  
> 1. Find PEW of the base's unit digit  
> 2. Calculate: `n mod (PEW size)`  
> 3. Look up that position in the PEW cycle

#### Example 1: What does 2¹⁰⁰ end with?

```
PEW(2) = (2, 4, 8, 6)  →  size = 4
100 mod 4 = 0  →  means "4th position" (0 = complete cycle)
Answer: 6 ✓
```

#### Example 2: What does 2¹⁰¹ end with?

```
PEW(2) = (2, 4, 8, 6)  →  size = 4
101 mod 4 = 1  →  1st position
Answer: 2 ✓
```

Visualizing 2⁹⁷ through 2¹⁰¹:
```
2⁹⁷ = ...2    (position 1)
2⁹⁸ = ...4    (position 2)
2⁹⁹ = ...8    (position 3)
2¹⁰⁰ = ...6   (position 4)
2¹⁰¹ = ...2   (position 1) ↩️ cycle restarts
```

---

## 🎯 Solving the Original Problem

### Step 1: Simplify the Problem

From the problem:
- Unit digit of **(408X)⁶³** = Unit digit of **X⁶³**
- Unit digit of **(789Y)⁸⁵** = Unit digit of **Y⁸⁵**

**Reframed problem:**  
> Find X and Y (where X ≠ Y) such that **X⁶³** and **Y⁸⁵** have the **same unit digit**.

---

### Step 2: Build the Complete PEW Table

| Base | PEW | Cycle Size |
|:----:|:---:|:----------:|
| 0 | (0) | 1 |
| 1 | (1) | 1 |
| 2 | (2, 4, 8, 6) | 4 |
| 3 | (3, 9, 7, 1) | 4 |
| 4 | (4, 6) | 2 |
| 5 | (5) | 1 |
| 6 | (6) | 1 |
| 7 | (7, 9, 3, 1) | 4 |
| 8 | (8, 4, 2, 6) | 4 |
| 9 | (9, 1) | 2 |

---

### Step 3: Calculate Mod Values

For **X⁶³**:
```
63 mod 4 = 3  →  for bases with cycle size 4
63 mod 2 = 1  →  for bases with cycle size 2
```

For **Y⁸⁵**:
```
85 mod 4 = 1  →  for bases with cycle size 4
85 mod 2 = 1  →  for bases with cycle size 2
```

---

### Step 4: Compute Unit Digits for Each Base

| Base | PEW | X⁶³ ends with | Y⁸⁵ ends with |
|:----:|:---:|:-------------:|:-------------:|
| 0 | (0) | 0 | 0 |
| 1 | (1) | 1 | 1 |
| 2 | (2, 4, 8, 6) | **8** ← 3rd position | **2** ← 1st position |
| 3 | (3, 9, 7, 1) | **7** ← 3rd position | **3** ← 1st position |
| 4 | (4, 6) | **4** ← 1st position | **4** ← 1st position |
| 5 | (5) | 5 | 5 |
| 6 | (6) | 6 | 6 |
| 7 | (7, 9, 3, 1) | **3** ← 3rd position | **7** ← 1st position |
| 8 | (8, 4, 2, 6) | **2** ← 3rd position | **8** ← 1st position |
| 9 | (9, 1) | **9** ← 1st position | **9** ← 1st position |

---

### Step 5: Find Matching Pairs

We need: **X⁶³ unit digit = Y⁸⁵ unit digit** where **X ≠ Y**

Looking for matches **across different rows**:

| X⁶³ ends with | Y⁸⁵ ends with | X | Y | Match? |
|:-------------:|:-------------:|:-:|:-:|:------:|
| 8 | 8 | 2 | 8 | ✅ |
| 7 | 7 | 3 | 7 | ✅ |
| 3 | 3 | 7 | 3 | ✅ |
| 2 | 2 | 8 | 2 | ✅ |

---

## ✨ Solution

### Valid (X, Y) Pairs:

| X | Y | X⁶³ ends with | Y⁸⁵ ends with | X + Y |
|:-:|:-:|:-------------:|:-------------:|:-----:|
| 2 | 8 | 8 | 8 | **10** |
| 3 | 7 | 7 | 7 | **10** |
| 7 | 3 | 3 | 3 | **10** |
| 8 | 2 | 2 | 2 | **10** |

---

## 🎉 Final Answer

$$\boxed{X + Y = 10}$$

---

## 🧠 Key Takeaways

1. **Only the unit digit of the base matters** when finding unit digits of powers.

2. **PEW sizes are limited:** Only 1, 2, or 4 — so we only need to mod by 2 or 4.

3. **The "swap pattern":** When power positions differ (like 3rd vs 1st in a cycle-4):
   - 2 ↔ 8 (both sum to 10)
   - 3 ↔ 7 (both sum to 10)

4. **This is why X + Y = 10 appears so frequently** in these problems!

---

## 📝 Quick Reference: PEW Table

```
┌──────┬─────────────┬──────────┐
│ Base │    PEW      │   Size   │
├──────┼─────────────┼──────────┤
│  0   │    (0)      │    1     │
│  1   │    (1)      │    1     │
│  2   │ (2,4,8,6)   │    4     │
│  3   │ (3,9,7,1)   │    4     │
│  4   │   (4,6)     │    2     │
│  5   │    (5)      │    1     │
│  6   │    (6)      │    1     │
│  7   │ (7,9,3,1)   │    4     │
│  8   │ (8,4,2,6)   │    4     │
│  9   │   (9,1)     │    2     │
└──────┴─────────────┴──────────┘
```

---

*Happy Problem Solving! 🚀*