In my article “Patterns in the Last Digits of the Positive Powers of Five” I showed that the cycles of ending digits of the positive powers of five could be represented with a binary tree:

The tree layout shows that certain pairs of ending digits are related, and that **these pairs differ by five in their starting digits**. I will show why this is true.

## Ending Digit Cycles

The ending digit cycles of the positive powers of five can be determined by incremental calculation modulo powers of ten. The resulting calculations can be tabulated as follows:

**1-digit endings****5**: 5^{1}

**2-digit endings****5**: 25^{2}

**3-digit endings****5**: 125^{3}- 5
^{4}: 625

**4-digit endings****5**: 0625^{4}- 5
^{5}: 3125 - 5
^{6}: 5625 - 5
^{7}: 8125

**5-digit endings****5**: 03125^{5}- 5
^{6}: 15625 - 5
^{7}: 78125 - 5
^{8}: 90625 - 5
^{9}: 53125 - 5
^{10}: 65625 - 5
^{11}: 28125 - 5
^{12}: 40625

**…**

Each group of m-digit endings repeats in a cycle. Each cycle is a power of two in length, and for m ≥ 2, equals 2^{m-2}.

Ending digits are labeled with specific powers of five: those that make up the first occurrence of each cycle. Each cycle — from the 3-digit endings on — contains the ending digits of 5^{m} through 5^{(m+2m-2-1)}.

## Ending Digit Cycles In Tree Form

The pairing of ending digits in the binary tree shows a relationship between endings in successive cycles; in particular, for level 3 and higher:

- Each pair of m digit endings has a common m-1 digit suffix.
- The starting digits of each pair of m digit endings differ by five.

## Why Pairs of Siblings Have the Same Suffix

Why is there always a pair of siblings, and why do siblings match up as they do? The answer lies in the nesting of power of two sized cycles of ending digits. For example, the last four digits repeat in a cycle of four, and the last five digits repeat in a cycle of eight. To form the eight unique five digit endings, the set of four digit endings must be repeated; duplicate four digit endings will have different starting digits prefixed.

Endings with the same suffix are a half cycle length apart, and are paired as siblings. For example, in the length eight cycle of five ending digits, the following endings are paired: 1st and 5th; 2nd and 6th; 3rd and 7th; 4th and 8th.

In terms of powers of five, sibling pairs differ in their exponents by half a cycle length. You can see this by looking at the underlying powers of five in the tree:

## Why the Starting Digits of Siblings Differ by Five

To show why the starting digits of siblings differ by five, let’s look at an example. In level 5 of the tree — the 5-digit endings — let’s compute the difference between each pair of powers of five (I’ll go in cycle order, not in tree order):

- 5
^{9}– 5^{5}= 1950000 - 5
^{10}– 5^{6}= 9750000 - 5
^{11}– 5^{7}= 48750000 - 5
^{12}– 5^{8}= 243750000

You can see that each differs by five in their fifth digit — the algebra behind the subtraction shows why:

- 5
^{9}– 5^{5}= 5^{5}(5^{4}– 1) = 5^{0}·**5**^{5}(5^{4}– 1) - 5
^{10}– 5^{6}= 5^{6}(5^{4}– 1) = 5^{1}·**5**^{5}(5^{4}– 1) - 5
^{11}– 5^{7}= 5^{7}(5^{4}– 1) = 5^{2}·**5**^{5}(5^{4}– 1) - 5
^{12}– 5^{8}= 5^{8}(5^{4}– 1) = 5^{3}·**5**^{5}(5^{4}– 1)

Let’s analyze these expressions by evaluating them in three stages:

**5**^{4}– 1This expression has a factor of 2

^{4}. I’ve shown that 5^{2n}– 1 has exactly n+2 factors of 2; that is, a factor of 2^{n+2}.**5**^{5}(5^{4}– 1)This expression has a factor of 5

^{5}·2^{4}= 5·10^{4}= 50000.**5**^{i}·5^{5}(5^{4}– 1), 0 ≤ i ≤ 3This expression ends in 50000. For i > 0, 5

^{i}ends in the digit 5; for i = 0, 5^{i}= 1. In either case, multiplying by 5^{i}leaves the 5 in the fifth digit unchanged.

### Generalizing

The example generalizes to show that every pair of endings in *every* level m of the tree, m ≥ 3, differ by 5 in their starting digits:

- Cycle length is 2
^{m-2} - Level m includes the powers of five 5
^{m}through 5^{(m+2m-2-1)} - Siblings are the powers of five p and p·5
^{2m-3} - The difference between each sibling pair is 5
^{i}·5^{m}·(5^{2m-3}– 1), for each i between 0 and 2^{m-3}– 1 - The factor 5
^{2m-3}– 1 itself has a factor of 2^{m-1} - The factor 5
^{m}·(5^{2m-3}– 1) itself has a factor of 5^{m}·2^{m-1}= 5·10^{m-1} - 5·10
^{m-1}is an m-digit number consisting of the digit 5 followed by m-1 zeros - The factor 5
^{i}leaves the last m digits unchanged: the digit 5 followed by m-1 zeros