Repeating Decimals in Fractions of Prime Numbers

by Bill Price


Fractions of the form n/p, where p is a prime number and n is a positive integer less than p, and p is not a factor of 10 (i.e., the primes 2 and 5), result in repeating decimals with very definite patterns.

For any prime number p above, the set of all repeating decimals derived from the fractions 1/p, 2/p, 3/p, ... (p-1)/p is made up of equal-length "chains" of digits that repeat themselves at fixed intervals. There can be one or more unique "chains" of digits in this set, depending on the value of p. The length of any one of these unique chains of digits appears to have a definite relationship to the number of such unique chains for any prime p. This relationship can be described as follows:

If p is the prime, and x is the length of the chain, and y is the number of unique chains found for all 1/p, 2/p, 3/p, ... (p-1)/p, then xy = p-1.

Note that I define a "unique" chain as a unique sequence of digits that can be duplicated in another value of n/p, beginning with a different digit of the unique chain, and wrapping around for the same number of digits. For example, 142857, 428571, and 571428 all represent the same unique chain of six digits for the prime 7.

Moreover, if x is an even number, then the digits of the first half of the chain are 9's complements of the corresponding digits of the second half of the chain, that is, they add up to 9.

If x is an odd number, then y is always even, and the chains can be grouped into pairs such that all the digits of one chain are 9's complements of the corresponding digits in the other chain.

Regardless of the length of any chain, whether an odd or even number of digits, the integer that it represents is evenly divisible by 9. This can be seen by successively adding up all digits and the digits of the resulting sums, until a one-digit sum of 9 is obtained.

As the value of p increases, the values of x and y do not reveal any discernable pattern, other than the relationship given above.

These properties apply to all prime numbers, excluding 2 and 5, and only because they just happen to be factors of 10, the base of our numbering system. Since 10 is evenly divisible by both 2 and 5, neither 1/2 nor 1/5 exhibit the above properties.  If, however, our numbering system were based on a prime number (base 17 for instance - see next topic below), then these properties would hold true for all primes (except, of course, for the base prime itself).

These properties of prime decimal chains may be illustrated by the first ten primes (excluding 2 and 5):


Prime: 3

2 chains of 1:

3

6

x = 1, y = 2

The digits complement each other.

3 + 6 = 9.


Prime: 7

1 chain of 6:

142857

x = 6, y = 1

The first three digits 142 complement the last three 857.

142857 / 9 = 15873.


Prime: 11

5 chains of 2:

09

18

27

36

45

x = 2, y = 5

The sum of each pair of digits equals 9.


Prime: 13

2 chains of 6:

076923

153846

x = 6, y = 2

The first three digits of each chain complement the last three.

76923 / 9 = 8547

153846 / 9 = 17094


 Prime: 17

1 chain of 16:

0588235294117647

x = 16, y = 1

The first eight digits 05882352 complement the following 94117647.

Sum of digits = 72; 7 + 2 = 9


Prime 19:

1 chain of 18:

052631578947368421

x = 18, y = 1

The first nine digits 052631578 complement the following 947368421.

Sum of digits = 81; 8 + 1 = 9


Prime: 23

1 chain of 22:

0434782608695652173913

x = 22; y = 1

The first eleven digits 04347826086 complement the following 95652173913.

Sum of digits = 99; 9 + 9 = 18; 1 + 8 = 9


Prime: 29

1 chain of 28:

0344827586206896551724137931

x = 28; y = 1

The first fourteen digits 03448275862068 complement the following 96551724137931.

Sum of digits = 126; 1 + 2 + 6 = 9


Prime: 31

2 chains of 15:

032258064516129

967741935483870

x = 15; y = 2

The two chains complement each other.

Sum of digits of first chain = 54; 5 + 4 = 9

Sum of digits of second chain = 81; 8 + 1 = 9


Prime: 37

12 chains of 3:

027

972

054

945

081

918

135

864

162

837

243

756

x = 3; y = 12

Again, all of the chains pair up with other chains to form complements. And again, all of the chains represent number divisible by 9.


Looking ahead to the primes up to 499, we find the same patterns:

Prime x y
41 5 8
43 21 2
47 46 1
53 13 4
59 58 1
61 60 1
67 33 2
71 35 2
73 8 9
79 13 6
83 41 2
89 44 2
97 96 1
101 4 25
103 34 3
107 53 2
109 108 1
113 112 1
127 42 3
131 130 1
137 8 17
139 46 3
149 148 1
151 75 2
157 78 2
163 81 2
167 166 1
173 43 4
179 178 1
181 180 1
191 95 2
193 192 1
197 98 2
199 99 2
211 30 7
223 222 1
227 113 2
229 228 1
233 232 1
239 7 34
241 30 8
251 50 5
257 256 1
263 262 1
269 268 1
271 5 54
277 69 4
281 28 10
283 141 2
293 146 2
307 153 2
311 155 2
313 312 1
317 79 4
331 110 3
337 336 1
347 173 2
349 116 3
353 32 11
359 179 2
367 366 1
373 186 2
379 378 1
383 382 1
389 388 1
397 99 4
401 200 2
409 204 2
419 418 1
421 140 3
431 215 2
433 432 1
439 219 2
443 221 2
449 32 14
457 152 3
461 460 1
463 231 2
467 233 2
479 239 2
487 486 1
491 490 1
499 498 1

We see that for the vast majority of these primes, the value of x is greater than y; in fact, most y values are very low numbers, from 1 to 3.  In very few cases does the value y greatly exceed the value x (as in 101, 137, 239, and 271).


Other Number Bases

These same properties hold true for primes in any numbering system, that is to say, they are not just phenomena of our base 10 numbering system, but are phenomena unique to primes themselves, independently of how they are represented in symbols. Let us take, for instance, a base of 17, and for the digits that represent the numbers 10 through 16 we use the letters A through G.

In base 17 the relationship xy = p-1 still holds true. However, since we are now working with base 17 instead of base 10, the digits are 16's complements, represented by the symbol G. Note also that 1 / 2 and 1 / 5 now step out from under the shadow of base 10 and reveal their inherent "primeness".


Prime: 2

1 chain of 1:

8

(8 is half of G)

x = 1, y = 1


Prime: 3

1 chain of 2

5B

x = 2, y = 1

The digits complement each other.

5 + B = G


Prime: 5

1 chain of 4:

36DA

x = 4, y = 1

The first two digits 36 complement the following DA.

Sum of digits = 3 + 6 + D + A = 1F;  1 + F = G


Prime: 7

1 chain of 6:

274E9C

x = 6, y = 1

The first three digits 274 complement the following E9C.

Sum of digits = 2 + 7 + 4 + E + 9 + C = 2E; 2 + E = G


Prime: 11

1 chain of 10:

194ADF7C63

x = 10, y = 1

The first three digits 194AD complement the following F7C63.

Sum of digits = 1 + 9 + 4 + A + D + F + 7 + C + 6 + 3 = 4C; 4 + C = G


Prime: 13

2 chains of 6:

153FBD

2A7E69

x = 6, y = 2

The first three digits of each chain complement the last three.

Sum of digits in both cases are multiples of G.


Prime: 19

2 chains of 9:

0F39E5648

G1D72BAC8

x = 9, y = 2

The chains complement each other.

Sum of digits in both cases are multiples of G.


Prime: 23

1 chain of 22:

0C9A5F8ED52G476B1823BE

x = 22, y = 1

The first three digits 0C9A5F8ED52 complement the following G476B1823BE.

Sum of digits is multiple of G.


Prime: 29

7 chains of 4:

09G7

12FE

1CF4

25EB

38D8

4BC5

67A9

x = 4, y = 7

The first two digits of each chain complement the last two.

Sum of digits in all cases are multiples of G.


Prime: 31

1 chain of 30:

09583E469EDC11AG7B8D2CA7234FF6

x = 30, y = 1

The first fifteen digits 09583E469EDC11A complement the following G7B8D2CA7234FF6.

Sum of digits is multiple of G.


Prime: 37

1 chain of 36:

07DD58C6F2CEBG1675G933B84A1E4250FA9B

x = 36, y = 1

The first eighteen digits 07DD58C6F2CEBG1675 complement the following G933B84A1E4250FA9B.

Sum of digits is multiple of G.


Looking ahead to the primes up to 499, we again find the same patterns, but with x and y values differing from base 10:

Prime x y
41 40 1
43 21 2
47 23 2
53 26 2
59 29 2
61 60 1
67 33 2
71 10 7
73 24 3
79 26 3
83 41 2
89 44 2
97 96 1
101 10 10
103 51 2
107 106 1
109 36 3
113 112 1
127 63 2
131 130 1
137 68 2
139 138 1
149 37 4
151 75 2
157 39 4
163 54 3
167 166 1
173 172 1
179 89 2
181 36 5
191 95 2
193 192 1
197 196 1
199 66 3
211 210 1
223 37 6
227 226 1
229 19 12
233 232 1
239 119 2
241 80 3
251 125 2
257 32 8
263 131 2
269 268 1
271 135 2
277 276 1
281 140 2
283 282 1
293 73 4
307 102 3
311 310 1
313 312 1
317 316 1
331 165 2
337 112 3
347 346 1
349 58 6
353 88 4
359 179 2
367 366 1
373 62 6
379 378 1
383 191 2
389 97 4
397 132 3
401 400 1
409 51 8
419 418 1
421 210 2
431 430 1
433 27 16
439 438 1
443 221 2
449 448 1
457 38 12
461 230 2
463 231 2
467 233 2
479 478 1
487 486 1
491 49 10
499 498 1

 


Chart Survey for Number Bases 11-27

These following chart surveys the relationships between x and y for number bases from 11 through 28, for the primes 7 through 199. The empty cells appear in those instances where the prime in question is a factor of the number base chosen.

Prime base 11 x/y base 12 x/y base 13 x/y base 14 x/y base 15 x/y base 16 x/y base 17 x/y base 18 x/y base 19 x/y base 20 x/y base 21 x/y base 22 x/y base 23 x/y base 24 x/y base 25 x/y base 26 x/y base 27 x/y base 28 x/y
7 3/2 6/1 2/3 - 1/6 3/2 6/1 3/2 6/1 2/3 - 1/6 3/2 6/1 3/2 6/1 2/3 -
11 - 1/10 10/1 5/2 5/2 5/2 10/1 10/1 10/1 5/2 2/5 - 1/10 10/1 5/2 5/2 5/2 10/1
13 12/1 2/6 - 1/12 12/1 3/4 6/2 4/3 12/1 12/1 4/3 3/4 6/2 12/1 2/6 - 1/12 12/1
17 16/1 16/1 4/4 16/1 8/2 2/8 - 1/16 8/2 16/1 4/4 16/1 16/1 16/1 8/2 8/2 16/1 16/1
19 3/6 6/3 18/1 18/1 18/1 9/2 9/2 2/9 - 1/18 18/1 18/1 9/2 9/2 9/2 3/6 6/3 9/2
23 22/1 11/2 11/2 22/1 22/1 11/2 22/1 11/2 22/1 22/1 22/1 2/11 - 1/22 11/2 11/2 11/2 22/1
29 28/1 4/7 14/2 28/1 28/1 7/4 4/7 28/1 28/1 7/4 28/1 14/2 7/4 7/4 7/4 28/1 28/1 2/14
31 30/1 30/1 30/1 15/2 10/3 5/6 30/1 15/2 15/2 15/2 30/1 30/1 10/3 30/1 3/10 6/5 10/3 15/2
37 6/6 9/4 36/1 12/3 36/1 9/4 36/1 36/1 36/1 36/1 18/2 36/1 12/3 36/1 18/2 3/12 6/6 18/2
41 40/1 40/1 40/1 8/5 40/1 5/8 40/1 5/8 40/1 20/2 20/2 40/1 10/4 40/1 10/4 40/1 8/5 40/1
43 7/6 42/1 21/2 21/2 21/2 7/6 21/2 42/1 42/1 42/1 7/6 14/3 21/2 21/2 21/2 42/1 14/3 42/1
47 46/1 23/2 46/1 23/2 46/1 23/2 23/2 23/2 46/1 46/1 23/2 46/1 46/1 23/2 23/2 46/1 23/2 23/2
53 26/2 52/1 13/4 52/1 13/4 13/4 26/2 52/1 52/1 52/1 52/1 52/1 4/13 13/4 26/2 52/1 52/1 13/4
59 58/1 29/2 58/1 58/1 29/2 29/2 29/2 58/1 29/2 29/2 29/2 29/2 58/1 58/1 29/2 29/2 29/2 29/2
61 4/15 15/4 3/20 6/10 15/4 15/4 60/1 60/1 30/2 5/12 12/5 15/4 20/3 20/3 15/4 60/1 10/6 20/3
67 66/1 66/1 66/1 11/6 11/6 33/2 33/2 66/1 33/2 66/1 33/2 11/6 33/2 11/6 11/6 33/2 22/3 66/1
71 70/1 35/2 70/1 10/7 35/2 35/2 10/7 35/2 35/2 7/10 70/1 70/1 14/5 35/2 5/14 14/5 35/2 70/1
73 72/1 36/2 72/1 72/1 72/1 9/8 24/3 18/4 36/2 72/1 24/3 8/9 36/2 12/6 36/2 72/1 4/18 72/1
79 39/2 26/3 39/2 26/3 26/3 39/2 26/3 13/6 39/2 39/2 13/6 13/6 3/26 6/13 39/2 39/2 26/3 78/1
83 41/2 41/2 82/1 82/1 82/1 41/2 41/2 82/1 82/1 82/1 41/2 82/1 41/2 82/1 41/2 41/2 41/2 41/2
89 22/4 8/11 88/1 88/1 88/1 11/8 44/2 44/2 88/1 44/2 44/2 22/4 88/1 88/1 22/4 88/1 88/1 88/1
97 48/2 16/6 96/1 96/1 96/1 12/8 96/1 16/6 32/3 32/3 96/1 4/24 96/1 24/4 48/2 96/1 16/6 32/3
101 100/1 100/1 50/2 10/10 100/1 25/4 10/10 100/1 25/4 50/2 50/2 50/2 50/2 25/4 25/4 100/1 100/1 100/1
103 102/1 102/1 17/6 17/6 51/2 51/2 51/2 51/2 51/2 102/1 102/1 34/3 17/6 34/3 51/2 51/ 34/3 51/2
107 53/2 53/2 53/2 53/2 106/1 53/2 106/1 106/1 53/2 106/1 106/1 106/1 53/2 106/1 53/2 106/1 53/2 106/1
109 108/1 54/2 108/1 108/1 27/4 9/12 36/3 108/1 36/3 54/2 27/4 27/4 36/3 108/1 27/4 27/4 9/12 54/2
113 56/2 112/1 56/2 28/4 4/28 7/16 112/1 8/14 112/1 112/1 112/1 56/2 112/1 112/1 56/2 56/2 112/1 7/16
127 63/2 126/1 63/2 126/1 63/2 7/18 63/2 63/2 3/42 6/21 63/2 9/14 126/1 18/7 21/6 63/2 42/3 18/7
131 65/2 65/2 65/2 130/1 65/2 65/2 130/1 26/5 26/5 65/2 65/2 130/1 130/1 26/5 65/2 130/1 65/2 65/2
137 68/2 136/1 136/1 34/4 34/4 17/8 68/2 34/4 68/2 136/1 136/1 34/4 136/1 136/1 68/2 136/1 136/1 68/2
139 69/2 138/1 69/2 46/3 138/1 69/2 138/1 138/1 138/1 69/2 138/1 138/1 46/3 69/2 69/2 138/1 46/3 69/2
149 148/1 148/1 148/1 148/1 148/1 37/4 37/4 148/1 37/4 74/2 148/1 74/2 148/1 74/2 37/4 74/2 148/1 37/4
151 75/2 150/1 150/1 150/1 150/1 15/10 75/2 75/2 5/30 25/6 75/2 75/2 30/5 50/3 75/2 50/3 50/3 50/3
157 39/4 3/52 6/26 13/12 156/1 13/12 39/4 156/1 39/4 156/1 156/1 12/13 52/3 156/1 78/2 156/1 26/6 4/39
163 162/1 162/1 54/3 81/2 81/2 81/2 54/3 162/1 162/1 162/1 27/6 27/6 18/9 81/2 27/6 81/2 54/3 54/3
167 83/2 83/2 166/1 83/2 166/1 83/2 166/1 83/2 83/2 166/1 83/2 83/2 166/1 83/2 83/2 166/1 83/2 83/2
173 172/1 172/1 86/2 43/4 86/2 43/4 172/1 172/1 172/1 172/1 86/2 43/4 43/4 86/2 86/2 172/1 172/1 172/1
179 178/1 89/2 89/2 89/2 89/2 89/2 89/2 178/1 89/2 89/2 178/1 89/2 178/1 178/1 89/2 178/1 89/2 178/1
181 90/2 90/2 45/4 45/4 45/4 45/4 36/5 180/1 4/45 90/2 180/1 20/9 180/1 180/1 15/12 12/15 15/12 180/1
191 38/5 95/2 95/2 38/5 95/2 95/2 95/2 95/2 190/1 95/2 190/1 190/1 95/2 95/2 19/10 95/2 95/2 190/1
193 64/3 24/8 64/3 32/6 192/1 24/8 192/1 96/2 192/1 64/3 48/4 192/1 32/6 32/6 96/2 192/1 16/12 48/4
197 196/1 196/1 196/1 4/49 98/2 49/4 196/1 196/1 14/14 28/7 196/1 98/2 49/4 49/4 98/2 98/2 196/1 49/4
199 22/9 66/3 99/2 99/2 198/1 99/2 66/3 11/18 18/11 99/2 18/11 198/1 99/2 18/11 33/6 99/2 66/3 33/6

Dimensions, ch.1 | Dimensions, ch.2 | Dimensions, ch.3 | Dimensions, ch.4 | Dimensions, ch.5 | Hypercube formula | Visual Definition of Primes | Calculator Trick | Decimal Equivalents of Fractions | Mental Calendar Trick | Kaleidodigit | Cobol Sudoku Solver | Math | Home Page


Copyright 1998 by Bill Price