Thursday, October 6, 2022

Exploring Ending Digits of Prime Numbers in Other Bases

I've been reviewing the distribution of ending digits of prime numbers expressed in base 10 and in other bases. For the purpose of this exercise, I used the first 304 prime numbers which begin with 2 and end with 2003. This list is at bottom of this post. 

Starting with base 10 is a good starting point. Most people have seen that these primes only end with digits 1, 2, 3, 5, 7 and 9. After 5, 2 and 5 are no longer the ending digit of primes since even numbers greater than 2 are not prime and multiples of 5 all end in 5 or 0. Excluding 2 and 5, the distribution of ending digits of primes in from this list is as follows:

Ending    Distribution
Digit

1                73
3                79
7                77
9                73

Tables of these first 304 primes expressed in bases 2 through 23 and the distribution of the prime number ending digits in these bases is available here.

Here is excerpt from the table showing the distribution for bases 2-10:

Bases 2-10 distribution of ending digits (first 304 primes)
Ending Digit2345678910
13031481477314846684773
201551781481511
3001567915378179
4000730500510
500001545479541
60000052000
7000000785077
80000000500
90000000073
0110101000

Some observations from the above table:

In base 2, all primes end with a 1 except for 2 in base 2 which is 10 and it ends in 0. This makes sense because all primes greater than 2 are odd numbers and all odd numbers in base 2 end with the digit 1.

Notice that all primes over 3 in base 6 end in the digits 1 or 5. This can be explained by the fact that all primes over 3 are multiples of 6 minus 1 or plus 1 (for example 5 and 7). See these two other posts for more information on this prime number property:

A Prime Number Property Rediscovered 

Prime Number Sandwich

Base 7 is also interesting in its distribution of ending digits in that it includes all possible digits 0 through 6. The prime 7 expressed in base 7 is 10; however, that is the last time in this base that a prime ends in 0 because any higher number in base 7 ending in 0 will be a multiple of 7 (such as 14 in base 7 is 20 and 49 in base 7 is 100) and therefore, is not prime. Also, the ending digits are fairly even distributed between the digits 1 through 6.

The distribution for base 7 prime ending digits begs the question of whether there are bases higher than 10 for which all possible ending digits are used. The attached spreadsheet has a tab for bases 11 through 23. The summary of ending digit distributions is (note - letters are used as digits to express numbers in bases higher than 10):

Bases 11 through 19 - Ending digit distribution (first 304 primes)
Ending digit11121314151617181920212223
127702546343420471435222716
233128140121117126113
33012653139201193913015
429025037017021025015
5307725541381754191263013
6300240001601500012
7337826138402050184113316
832026039020017024011
92902547034180153502913
01010001010001
A3002500019017024015
B077245039392050193825114
C00240002001600012
D00052394119511940263211
E00003602101400014
F000003819014002915
G00000016015022014
H0000000501636283015
I000000001800014
J00000000038283215
K000000000026013
L000000000003016

It appears that when the base is a prime, that all possible digits are found as the ending digit of prime numbers expressed in these other bases. I say "appears" because this is a limited table (limited in number of primes and in bases) and can't be considered a proof. The table shows this for prime bases up to 23. Although not included in the table, I've also confirmed this for primes up to 31.

In a related topic, Dirichlet's theoremstates that for any two positive coprime integers a and d, there are infinitely many primes of the form a + nd, where n is also a positive integer. In other words, there are infinitely many primes that are congruent to a modulo d. I need to explore this theorem and the distribution of prime ending numbers to see how these concepts are linked.

This is another link discussing ending digits.

Numberphile has an interesting video about ending digits of prime numbers: (224) The Last Digit of Prime Numbers - Numberphile - YouTube

List of first 304 primes (2 through 2003) used for the distribution tables above:

2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97
101
103
107
109
113
127
131
137
139
149
151
157
163
167
173
179
181
191
193
197
199
211
223
227
229
233
239
241
251
257
263
269
271
277
281
283
293
307
311
313
317
331
337
347
349
353
359
367
373
379
383
389
397
401
409
419
421
431
433
439
443
449
457
461
463
467
479
487
491
499
503
509
521
523
541
547
557
563
569
571
577
587
593
599
601
607
613
617
619
631
641
643
647
653
659
661
673
677
683
691
701
709
719
727
733
739
743
751
757
761
769
773
787
797
809
811
821
823
827
829
839
853
857
859
863
877
881
883
887
907
911
919
929
937
941
947
953
967
971
977
983
991
997
1009
1013
1019
1021
1031
1033
1039
1049
1051
1061
1063
1069
1087
1091
1093
1097
1103
1109
1117
1123
1129
1151
1153
1163
1171
1181
1187
1193
1201
1213
1217
1223
1229
1231
1237
1249
1259
1277
1279
1283
1289
1291
1297
1301
1303
1307
1319
1321
1327
1361
1367
1373
1381
1399
1409
1423
1427
1429
1433
1439
1447
1451
1453
1459
1471
1481
1483
1487
1489
1493
1499
1511
1523
1531
1543
1549
1553
1559
1567
1571
1579
1583
1597
1601
1607
1609
1613
1619
1621
1627
1637
1657
1663
1667
1669
1693
1697
1699
1709
1721
1723
1733
1741
1747
1753
1759
1777
1783
1787
1789
1801
1811
1823
1831
1847
1861
1867
1871
1873
1877
1879
1889
1901
1907
1913
1931
1933
1949
1951
1973
1979
1987
1993
1997
1999
2003

No comments:

Post a Comment

An Open Message to the Blog's Fans in Singapore

(Image:  Free 12 singapore icons - Iconfinder ) This past week, more views of this blog were made from Singapore than other country. To ackn...

Popular in last 30 days