mathematics
volume
january
of computation
4x. number 177
1987,pages 183-2(12
Primes at a Glance
By R. K. Guy, C. B. Lacampagne, and J. L. Selfridge
To Dan Shanks:
May he stay on form und again become the product of three of the first (our primes
Abstract.Let N = B - L. B > \L\,gcd(fl. /.) = 1, p \ BL for all primesp «; JÑ. Then N is
0. 1 or a prime. Writing N in this form suggests a primality and a squarefreeness test, if we
also require that when the prime q | BL and p < q then p | BL, we sav that B - L is a
presentation of N. We list all presentations found for any N. We believe our list is complete.
Just glance at
349 = 910 - 561 = 2-5-7-13 - 3-11 17.
Surely 349 is a prime, since it is less than 192 and each prime less than 19 appears in
exactly one of the two operands. How much more pleasant it is to test 349 for
primality by glancing at this difference than by using some other prime testing
algorithm.
We aim to find a pair of integers B and L with
(1)
(2)
(3)
N = B-L,
B>\L\,
gcd(5, L) = l,
(4)
if p < JÑ, then p dividesBL.
These conditions eliminate composite values of TV.We show that for given TV,not
composite, there are infinitely many choices for B. But we seek presentations of N,
those which satisfy the additional condition
(5)
if q\BL and p < q, then p\BL.
We believe strongly that this condition leads us to a finite list of presentations;
i.e., a finite set of TVand a finite set of B for each N. We know that the set of B is
finite for fixed N, N > 1.
Condition (5) could be replaced by various other conditions which would cut
down the infinite list, but this condition seems more attractive to us than any similar
condition on the prime factors of BL.
When N = 1 there is a relation between our work and that of D. H. Lehmer [1],
Lehmer found all pairs of consecutive integers 5 and S + 1 composed of primes up
to 41. We are interested in the special case when each of the first k primes is a factor
of S(S + 1). These presentations with TV= 1 are listed at the beginning of Table 4.
We know from [1] that there are no presentations with N = 1 and 19 < pk < 43.
Received June 3, 1986; revised July 10, 1986.
1980 Mathematics Subject Classification (1985 Revision). Primary 11A41.
1 1987 American Mathematical
Society
0025-5718/87 $1.00 + $.25perpage
183
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
184
R. K. GUY, C. B. LACAMPAGNE. AND J. L. SELFRIDGE
Algorithms to test if N is prime or squarefree. Theorem 1 below leads us to
primality and squarefreeness testing algorithms. The primality test is implicit in the
work of Lehmer [2]. We hope that the squarefreeness test will find practical use.
Theorem
1. N > 1 is prime if and only if it satisfies conditions (1) through (4).
Proof. U N > 1 satisfies conditions (1) through (4), then it is prime since it has no
prime factor p < ]/Ñ~.
If N is prime, split the product of all primes less than \[Ñ into two factors u and v
with gcd(w, v) = 1. Since the Diophantine equation ux — vy = 1 has infinitely many
solutions (x, j^with x > 0, put B = u(Nx + u), L = v(Ny + u). Now TV= B - L,
and since gcd(jV, B) = 1, we have gcd(Z?, L) = 1, and conditions (1) through (4) are
satisfied.
Primality test. Let pk < N < p2k+xand let M = px • ■■ pk be the product of the
first k primes, and M = QN + R, 0 < R < N. If R = 0, then JV is composite and
has no prime factor greater than pk. If R =£0, let G = gcd(N, R). Then G = 1 if
and only if N is prime.
Examples. Since 7 < 70 < ll2, take M = 210. Now 70 divides 210, so 70 is
composite and has no prime factor greater than 7.
101 is primebecause210 = 2 • 101 + 8 and gcd(101,8) = 1.
91 is composite since 210 = 2 •91 + 28 and gcd(91,28) = 7.
Note that the algorithm sometimes serves to factor the number.
Testing for primality using this algorithm takes only one long division and one
(short) gcd. For N < 106 it is faster or about as fast to prove primality using this
algorithm as to use a strong pseudoprime test with two bases (which requires about
40 squarings, 40 multiplications and 40 (or 80) divisions). Should you wish to test
N < 106 by this method,
you would need to store the product
of the primes up to
997. This requires 44 32-bit words. For N < 103, 104 or 105 the number of 32-bit
words is 2, 4 or 14.
Squarefreeness test. Express N as the product n,r=1£,' where the F¡ are squarefree.
Thus F¡ is the product of those prime factors of N which occur to exactly the z'th
power. For example, 8400 has Fx = 21, F2 = 5, F3 = 1, £4 = 2.
Choose k so that pk < N < p3k+ x. Now M = px • • ■ pk can be taken considerably
smaller than for the primality test.
As before, write M = QN + R. If R = 0, TVis squarefree and has no prime factor
greater than pk. Otherwise, let D0 = N and G0 = gcd(N, R). Let Dx = D0/G0 and
Gx = gcd(Dx,G0). Continue with Dt = Dl_x/Gi_x and G,■= gcd(0,, G¡_x) until
Gr=l.
Now see if Dr is a square. If so, and Dr > 1, then it is the square of a prime
greater than pk, and Fx = GQ/GX, F2 = (Gx/G2)2Dr. If Dr is not a square,
Fx = (G0/Gx)Dr and F2 = Gx/G2. In any case, F¡ = G¡^x/G¡ for 3 < i < r.
Examples. Since 3 < 106 < 53, we can use M = 6. Then G0 = gcd(6,106) = 2,
Dx = 106/2 = 53, and Gx = gcd(53,2) = 1. Since 53 is not square, 106 is squarefree.
For N = 1200, take M = 210. Then G0 = 30, Dx = 40, Gx = 10, D2 = 4,G2 = 2,
D3 = 2,G3 = 2, D4= 1,G4=
l.Thus(Fx,F2,F3,F4)=
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
(3,5,1,2).
185
PRIMES AT A GLANCE
For N = 3468, take M = 30030. Then C70= 6, Dx = 578, Gx = 2, D2 = 289,
G2 = 1. Since D2 is a square, Fx = G0/Gx = 3, F2 = (GX/G2)2D2 = 22172, and
N = 3 • 342.
For N = 323, take M = 30 and find that N is squarefree, but the test does not tell
whether N is prime or the product of two primes each of which is greater than 5.
For N = 3000, take M = 30030, finding that the squarefree part of 3000 is 3, and
the cubeful part is 103.
To test N < 106 you need store only four 32-bit words for the product of the
primes below the cube root of N. To test N < 109 you need 44 32-bit words.
Presentations of primes as sums. Our presentations have B > 0, but we may have
L < 0, e.g., 5 = 3- (-2). We write this difference as a sum and refer to the
presentation as a sum also. So our presentations include
5=
11 =
29 =
97 =
3 + 2,
2-3 + 5,
3-5 + 2-7,
5-11 + 2-3-7.
When we try to find such a presentation which uses the primes up to 13, the smallest
candidate is
347 = 2-7-13 + 3-5-11.
But take a second glance: 347 violates property (4) because 17 does not divide BL.
In fact, we show easily that there are only finitely many sums B + \L\ which satisfy
conditions (1) through (4).
Theorem 2. 167 ¡5 the largest N having a sum N = B + \L\ satisfying conditions (1)
through (4).
Proof. Larger primes must have 13 dividing a summand, and by the arithmetic
mean/geometric mean inequality,
u + v > 2{u~v~
> 2^2 -3-5-7-11-13
> 172.
For pk > 13, 2p. ■3 • • • pk > p2k+ x follows by induction. To see this, use the fact
that 2pk > pk + x, so for pk > 17,
PÏ > PÁPk+i/2)4 > 17(^ +1/2)4 > pt+x
and^
> iPk+i/Pkf-
There are 106 sums satisfying conditions (1) through (4). Of these, 87 also satisfy
condition (5). These are given in Table 1. Table 1 gives all such presentations for
primes less than or equal to 149 and for 167. It is easy to check that neither 151, 157,
nor 163 can be written as a sum satisfying conditions (1) through (4).
Presentations with fixed L.
Remark 1. 29 is the largest prime which can be presented as N = B — 1, and 31 is
the largest prime which can be presented as TV= B + 1.
Here pxp2 ■•■ pk\B and N < p2k+ x. Remark 1 follows immediately from
P1P2 '•■ Pk> PÏ+1 {oTPk> 7-
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
186
R. K. GUY. C. B. LACAMPAGNE. AND J. L. SELFRIDGE
Just the following numbers can be presented as N = B — 1 :
0=1-1,
1=2-1,
5 = 2-3-1.
17 = 2-32- 1.
23 = 233 - 1
7 = 23 - 1,
29 = 2 • 3 - 5
11 = 223 - 1,
3 = 22- 1,
1.
For N = B + 1, N = 2, 3, 5, 7, 13,19, and 31.
Table 1
Complete list of sum presentations of primes N = B + L
Only
First
Only
p,< /Ñ
p > /Ñ
p,< fÑ
used
also used
p> {Ñ
used
also used
H
/.
N
/.
«
->=
3
2
3
325
235
2-3-7
52
1
223-5
7
5-7
3-7
3-5
2: 7
2-5
3
2 3-5
3
II
2-3
5
13
2-5
3
32
3-
17
2"
19
5
2
y
2:
2;
5
23
2-5
225
v
233
5
3 ■5
2-3
1
2: 3
2-5
5
24
52
2-3 ■
52
3-'
2232
5"
2'5
31
25
325
2-52
237
3:5
327
2-32
2-33
2; 5
3-5
29
31
3
2-5-7
72
2-5-7
243
32 7
2 - 3-1
3 - 52
3 ■5
2: 3 - 7
2-5-7
3-7
2 ■32 5
2'7
2- 5
2 ■3 ■5
41
3-7
5-7
43
22 7
47
5-7
2-3-7
223
s
53
59
61
67
71
73
79
83
89
2-3-7
101
2-3-11
5-7
103
2-5-7
3-11
5-7
2
107
711
2-3-5
22 3 ■
72
109
2:33-5-
52
32 7
3-52
2-' 32
225
2-3
3-5
5
N
5-11
245
37
2-32
2'3
2-7
3-7
22 32
22 3
32
L
H
5-7
5-7
First
3-5-
32 7
2-72
5- 7
5-7
5-11
11
3-7
5-7
97
3- 5
3- 7
2-<5
22 7
2;
2-5:
3-5
2- 11
3-7
2:3-5
5- 11
2211
113
127
131
137
139
149
151
157
325
3- 11
7- 11
5-7
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
163
167
187
PRIMES AT A GLANCE
Remark 1 can be generalized. For fixed L, there are only a finite number of
presentations and an easy algorithm for determining all of them. We have already
done this if L is negative (Table 1). Sometimes there are no presentations.
Remark 2. There is no presentation when B or L is a prime p > 11 or when B or
L is mp, m < 6 and p > 13.
Also, there are no presentations for some other values of L, for example L = 36,
48, or 54. On the other hand, if B = 36, 48, or 54, we can use various values of L
including +35.
Table 2 gives presentations of the largest possible N for each positive L up to 56.
If Table 4 is indeed complete, then the reader can complete Table 2 by subtracting
and sorting, with L = 10906571664989
the last entry.
Table 2
Presentation of largest prime N = B — L for fixed L < 56
N =
29
103
67
101
79
29
113
97
61
53
no
23
B -
L
N =
B
L
1
2
3
4
5
6
7
8
9
10
11
12
no près.
13
no près.
29
14
15
16
47
77
no près.
73 105
30
31
32
151
139
89
165
154
105
no près.
17
35
no près.
43
63
89
110
83 105
no près.
11
35
101 126
no près.
113
140
137 165
-
30
105
70
105
84
35
120
105
70
63
près.
35
N =
17
18
19
20
21
22
23
24
25
26
27
28
B -
107
140
no près.
163
198
no près.
41
81
no près.
83
125
no près.
61
105
109
154
no près.
101
150
97
147
no près.
113
168
109
165
I.
33
34
35
36 to 39
40
41
42
43
44
45
46 to 48
49
50
51 to 54
55
56
Presentations using primes up to pk. For k fixed, there are only a finite number of
presentations using the first k primes. This follows from a theorem of Mahler, which
unfortunately
does not give a bound. We prove this for pk < 3 and list our
conjectured bounds on B in Table 3.
First, the presentations using no primes:
0 = 1-1,
1 = 1 + 0, 2 = 1 + 1.
pk = 2. Next, the presentations using the prime 2 only:
1 = 2-1,
3= 2+ 1
5 = 22 + l,
7 = 23-l.
= 22-l,
pk = 3. We would like to find all presentations using only powers of 2 and 3. We
know that N must be 1 or a prime less than 25. First we display the three
presentations of 1:
1 = 3 - 2 = 22 - 3 = 32 - 23.
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
188
R. K. GUY, C. B. LACAMPAGNE, AND J. L. SELFRIDGE
Table 3
Least and greatest B and count for given pk
Least B
Pk
0,1,2
1,3
1,5
1
2
3
6
15
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
1.11
1,29
55
13,97
17
182
715
3135
15015
113883
1344005
11874891
46149730
17118816000
10906571667510
1
41
157
263
971
1601
991
433
2521
Greatest B
.V
Count
1
0,1,2
7
3
5
13
29
77
8
256
32805
250047
3294225
8859375
95954936
172078592
22630400000
4021054856
135689153600
216745267200
1214151347500
17118816000
10906571667510
37
47
53
239
311
257
593
196
192
225
176
129
104
401
929
45
59
1213
433
2521
17
7
1
35
1
1242
Table 4
Main table of presentations of N = B — L
(N on left: pk above: B in body of table.)
u
6
10
16
25
XI
15
21
36
126
225
2401
4375
3X5
441
540
3025
9801
13
17
19
1716
2080
715
12376
633556
123201
194481
3
6
9
32
4
6
9
16
10
12
15
25
27
135
250
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
PRIMES AT A GLANCE
189
Table 4 ( continued )
11
11
8
9
12
27
6
15
20
36
75
13
9
12
16
256
10
15
18
25
40
45
17
9
18
81
12
15
20
27
32
125
19
16
18
27
10
15
24
25
64
100
144
23
24
27
32
15
18
20
48
50
648
2048
13
17
19
21
35
56
60
81
200
686
875
28
48
63
160
175
405
525
1728
35
42
45
80
192
360
392
5120
40
49
54
75
6144
30
35
63
98
128
135
55
90
343
363
3388
6250
151263
77
105
297
567
605
1232
1617
182
875
3185
67392
154
250
264
294
1944
2560
2835
4375
198
275
968
1815
3773
910
1540
1020
4114
5544
56595
660
2025
4235
5600
34398
75735
2025023
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
22253
190
R. K. GUY. C. B. LACAMPAGNE. AND J. L. SELFRIDGE
Table 4 ( continued )
29
5
7
11
20
24
30
45
54
125
15
35
50
189
225
245
729
1029
2430
21
45
175
4000
84
99
31
16
25
30
36
40
81
256
37
25
27
40
45
162
32805
41
36
45
50
81
43
25
40
45
48
75
243
47
27
32
45
50
72
13
17
19
23
260
5265
315
5775
1485 224939
3549
35750
59319
—
2437149
31
66
616
2275
4420 240856
196 1890 231231
41800
220 8281
5836831
231 40656
735
1120
1375
70 2457 373527 22477
92092
147
352
847
1225
2662
30
42
72
100
112
135
280
625
21 140
35 525
56 770
90 825
105 2541
125
216
195
756
1001
441
10976
28 120
693
63 175
715
70 5488 1408
168
3718
288
9360
343
35035
448
5767168
1323
35
42
75
147
672
250047
29
77
110
245
432
495
1125
24057
572
3575
15972
47432
59535
78125
1911
4760
21216
3135
884925
1382576
2695
—
8402240
159398280
—
5260948
— 5056527
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
191
PRIMES AT A GLANCE
Table 4 ( continued )
53
7
11
35
165
350
693
900
15488
3294225
60
63
98
200
245
2240
59
35
45
80
84
140
13
17
273
54978 218348
1925
983178 392445
4928 1596725
7203
13013
455
605
2600
3920
7605
12155
45500
297440
490
880
1755
10890
165
210
375
847
672
4225
1782
13377
3840 1574640
42592
33880
165375
216580
999702
224
539
675
1760
14700
19
23
29
31
55913
3105375
39721605
— 216745267200
42959
112710
315
61
500
40
70
75
%
196
250
3645
67
42
60
70
112
147
175
567
71
36
50
56
120
1296
73
45
63
70
105
108
343
448
105
336
385
37791
818125
3620925 553864311
600
126
176
225
231
896
1100
1331
6000
6875
46656
150
220
315
3993
2535
18375
154
429
924
1080
3159
5929
86515
385
528
46750
4475317
3536 1218750 328308695
16731 7260071
34391
11275335
3388 60588
413343 1836765
632320
1690
2548
7938
640
1225
1323
79
49
70
84
100
135
175
324
1024
189
2079
—
5434
37
— 1526175
27025999
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
34897072
192
R. K. GUY, C B. LACAMPAGNE, AND J. L SELFRIDGE
Table 4 (continued)
83
n
13
48
63
105
468
2288
90
363
308
17
2618
261443
1812608
19
23
29
31
17100
98
875
125
1568
245 160083
1875
19683
110 18954
2520 10374
89
54
75
210 154880
9945 24960
264
12584
84
105
320
36125
189
539
49049
224
980
65625
97
70
1287 23562
7223040
4295577
825
55
90
132
2275
30855
105
385 19305 47872
112
405 28125 316875
147
847 61347
160 35937 86625
972
101
56
26400 183141 36611676
66
231
80
486
1001
105
605
2376
126
114345
150
245
1701
3125
103
70
1078
1650 56628
63
193648
5124843750
75
180
1573
31603
105
378
2028 149175
175
495
6655 778855
243
2695 11088 4851495
250
343
5103
215985
77
107
72
1430
770 1630827
3216320
105
1680
2912
140
135
275
5915 17787
147
800 1664000
350
1232
450
8192
875 42875
— 2880514
5005
109
154
2475
60
7480
84
165
113
105
175
144
189
784
63
98
550
1089
3234
105
120
140
225
288
3200
168
245
960
1323
1485
26520
308
3003
1400 397488
2310
2808
9408
16038
22113
58080
182988
734825
2548260
51271025
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
2077383
31821903
193
PRIMES AT A GLANCE
Table 4 ( continued )
127
131
11
13
17
19
23
29
105
490
715
2002
3900
78975
40222
31977
60775
4494672
1754935
567
847
2800
8575
110
231
137
1155
1715
2156
7875
77
165
139
242
1215
1512
8712
84
154
315
825
83980
346060
1100512
560
20580
1496
2210
83006
462
1320
3465
823680
1820
4862
157437
637637
594
81675
1309
26880
48334
93639
270864
429
8619
51200
333944
31941
294151
11305
35035
182476
495
31
75004875
336394240
301796
74750
297297
1182775
1470
4374
149
151
105
275
875
1029
5000
6804
180224
165
231
396
756
157
163
4375
220
297
172032
198
240
625
3430
6400
7203
167
90
132
1575
539
4725
11979
57024
385
1911
8775
18993216
2533440
360126
9075
14157
33957
273
735
2275
6435
15288
1146880
440
882
1287
45927
1092
14080
32032
70227
254320
15015
1859872
5027913
41327
60500
289575
11790792
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
394128
129324195
194
R. K. GUY, C. B. LACAMPAGNE, AND J. L. SELFRIDGE
Table 4 ( continued )
13
173
693
3575
179
1089
1859
4235
5184
286
2106
4900
181
191
193
197
199
211
223
227
455
1001
8316
1183
7200
557568
1352
3200
274625
364
1144
1200
2695
8064
715
1485
11011
66550
1848
4095
7098
9295
1063348
3087
16562
229
385
233
728
5733
456533
17
13923
27200
845325
4004
73304
1713660
1105
3366
10296
1783600
3740
6160
12348
32368
5202
9360
53900
203840
790272
4840
6370
19
23
38610
29
37
8330
88179
161109
1042899
81900
—
665856
3322055
14025
62073
4955143
—
3031875
49212800
18525
273780
66759
4685824
2369851
146523
935935
3230
646875
183260
139553765
79135
676039
17448574
7735
165376
1547
6545
9152
6664
21250
148104
156000
4758325
4160
20825
31
139403
2585088
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
396785151
195
PRIMES AT A GLANCE
Table 4 (continued)
239
241
251
257
263
269
13
17
19
330
525
4914
25025
280280
339864
2145
4641
2348125
28665
116424945
1560
7986
67626
9975
2805
4235
1127357
276507
172078592
858
13013
17280
399168
454860
113883
10829
11319
244205
1155
8125
23595
12518324
50581800
624
1625
4719
11250
8859375
780
2100
11616
20625
55296
1001
3276
10976
17576
35000
455
572
1232
2457
7007
170625
770
1638
3773
6500
30888
819
18144
271
277
281
283
546
700
726
1701
420
550
585
4732
77077
199927
1001
1100
3185
43940
1053
1375
7290
29403
499408
23
29
31
427570
1837836
76580735
21252
1982251
2478175
74800
32725
125125
12597
1386
7106
54621
278460
26741
3003
5145
97240
799708
1329468
242902800
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
54553408
10X68910
196
R. K. GUY, C. B. LACAMPAGNE, AND J. L. SELFRIDGE
Table 4 ( continued )
17
293
307
311
313
317
331
337
347
349
353
359
2295
7293
401408
449280
2925
4675
104125
20111
95954936
18513
53625
187500
250563
11900
12285
28917
635250
2431
2541
4335
48841
1724800
7497
22022
57222
910
6069
30184
537600
3213
1430
14399
19
23
29
31
37
17765
29700
3493875
8398
116688
31920
328757
5226837
737352
4585625
8976
81081
—
7540435
16055
326040
—
2525860
533715
625974
336490
621537280
29393
134064
—
2653464
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
32232200
PRIMES AT A GLANCE
197
Table 4 (continued)
19
367
373
379
383
389
397
401
409
419
421
7150
1009375
88825
35700
1860859
32368000
53865
3315
23
29
31
37 41
43
2785552
4885545
119680
200583
1691228
181748637525
8008462
4021054856
247401
122265
2003001
12128480
4620
14820
3221925
431 14189175 127929375
433
439
443
449
457
461
463
467
479
487
491
17118816000
44044
168399
77520
7058700000
97020
384813
984998
42204149
230945
1449624
372400
4641
452200
542842300
6495853
65637
315392
30107
2880267
104867840
25350 16286595
207207
120666
270215
3970234604
1762475 111473477375
17346560
499
503
509
521
523
206250
25935
92378
51714
14535
32175
87465
339405
79420
33649
3076983
2091544
196815528
1344189
52003
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
R. K. GUY, C. B. LACAMPAGNE, AND J. L. SELFRIDGE
Table 4 ( continued )
23
482885
2891445
557
569
571
577
587
593
599
601
607
613
631
617
619
641
64.3
647
659
653
661
673
677
683
691
701
709
719
727
733
743
739
751
757
76V
773
787
797
809
811
821
823
31
37
41
prime values of N in lightface have no presentation
547
563
29
827
829
124355
75109944
544180
707200
1366936
664240
1138592
1461915
1785168
22630400000
8438976
1077375
302005
3287988
1454355
15249
60792680
156975
16159500
77931958
3587353308
142025
425425
447678
112112
269192
465290
124208630
19829446
607563
885115
1210007552
6236361450
1311000
15295
4956644
30218265
374374
5703126
21505
1562275
21037500
71413056
3297184
1329354
775681270
859180
1108304197
9604133
14987973
—
305767
490758912
1869878472
73547100
9970155
205751
7863401
143310141
252167630
82225
47887840
839
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
PRIMES AT A GLANCE
199
Table 4 ( continued )
29
853
859 863
877 881
31
17131257
857
4659016505
—
primes in lightface have no presentation
883
887
5428423
910455
226915575
13657732
2461722536
35083785
907
911
919
941
41
37
929
937
947
1284894
10560979
12065625
953
135689153600
3878875
8787725
762215400
78531235328
971
1344005
46149730
991
1019
71349135
198878700
1021
(8)* 1087 3768492000
1091
68103125
1093
187943925
1187 1163335667
(H)
1193
83741850
1201
100140625
1214151347500
1213
10378757220
1217
1259 5630473134
(5)
1303
8061768
(7)
(6)**
967
977 983
997 1009 1013
1373 1381
486159625
(23) 1553 12308642073
(6) 1601
11874891
47
2521 10906571667510
The
numbers in parentheses indicate the number of primes between boldface entries.
**There are 6 primes between 1303 and 1369.
We also find
5= 3+ 2
= 2-3-1
13 = 32 + 22
= 223 + 1,
23 = 233 - 1
= 33 - 22.
= 32 - 22,
7 = 22 + 3
= 2-3 + 1
17 = 32 + 23
= 2-32- 1,
= 32 - 2,
11 = 23 + 3
= 32 + 2
19 = 24 + 3
= 2-32 + 1,
= 223 - 1,
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
200
R. K. GUY, C. B. LACAMPAGNE, AND J. L. SELFRIDGE
Now let us find all presentations of the form
iV = |2u-3''|
with a > 2.
Since 3h = 1 or 3 (mod 8), we must have 3b - 2" when N = 1 or 3 (mod 8) and
2" - 3h when N = 5orl (mod 8).
There are no further solutions of 3* - 2" = 1, since if 16 \3h - 1 then 4 | b and
34 - 113*- 1, whichimpliesthat 5 12".
So we start with presentations of 5 and find
5 = 23 - 3.
If there is another presentation of 5 with a > 2, then the exponent of 2 must be
greater than 3 and the exponent of 3 must be greater than 1. We write
To + 3 _
ofc+1 _ \S _
"J
or (2" - 1)23 = (3* - 1)3.
Since 3 12" - 1 it follows that 2 | a, and since 2313* - 1 it follows that 2 | b.
Evidently, a = 2 and b = 2 is a solution. So we add
5 = 25 - 33
to our list, making five solutions.
We now prove that this list is complete. Suppose there is a presentation of 5 where
the exponent of 2 is greater than 5 and the exponent of 3 is greater than 3. Then
ja + 5 _ o/>+ 3 = ^5 _ t3
with a and b positive, and
(2a-
1)25 = (3fe- 1)33.
Now 22 = 1 (mod3), so 218= 1 (mod33) and 254 = 1 (mod34). Thus 18 | a but
27 + a. Also 32 = 1 (mod23), so 38 = 1 (mod25). Thus 8 | Z>but 16 + b. (We can use
the tables of factorizations [3] to look up factors of 2" - 1 and 3h - 1.) In this case,
we find that 41138—1, so 4113*- 1 and 4112" - 1, and hence 20 | a. We find that
111210—1, so 11 |3fr —1, and hence 5\b. Also 7|23 - 1, so 7|2a- 1, 713* —1,
6 | b and 30 | b. Now 2711330- 1, so 271|2a - 1, and hence 135 | a, which is a
contradiction since 27 I a. So all solutions of 5 = 2a - 3b are indeed listed above.
Our method finds all solutions and leads to a contradiction when there are no other
solutions.
We use the following notation for the argument above.
c _ ja + 5 _ ofr+3 =¡>
(2a - 1)25 = (3* - 1)33
181a and 27 1 a
%\b and 16 1 b
41138—1 =>41|2a- 1 =>20 | a
111210- 1 => ll|3fc- 1 => 5|6
7|23 - 1 => 7|36- 1 => 6|Z> => 30|6
2711330—1 =* 271 |2a- 1 => 135 | a =* 27 | a =»^=
There is only one more presentation of 7 with pk = 3,
7 = 24 - 32.
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
PRIMES AT A GLANCE
201
Proof. 1 = 2a+4 - 3h+2 =>
(2a - 1)24 = (3h - 1)32
61 a and 9 + a
4\b and Sib
7|23- 1 =» 7|3ft- 1 => 6|6=> 12 | 6
73 |312- 1 =* 73 |2" —1 =>9\a^=
There is only one more presentation of 11 with pk = 3,
11 = 33 - 24.
Proo/. 11 = 3fe+3 - 2a+4=>
(2a - 1)24 = (3h - 1)33
18 | a and 27 1 a
4 | 6 and 8 + 6
19 |218- 1 => 19 |3* —1 => 18 | 6
757 139- 1 =»757 12a- 1 =>756 | a =>27 | a ^>«=
For 13, we start with
13 = 24- 3
13 = 2a+4 - 3fc+1 =»
(2a - 1)24 = (3* - 1)3
4\b
and 80 13*—1.
Thus 5 |2a - 1 and 4 | a.
Now a = 4 and b = 4 is evidently a solution. So
13 = 28 - 35.
The presentations of 13 given above, plus these two, complete the list of presentations of 13 using only powers of 2 and 3.
Proof. 13 = 2a+8- 3b+5 =*
(2a - 1)28 = (3h - 1)35
1621a and 243 +a
64\b
and 128 +b
193 |316- 1 => 193 |2a- 1 => 96 | a
257 |216- 1 =>257 |3* - 1 =>256 | b => 128 | b =><=
There is only one more presentation of 17 with pk = 3,
17 = 34 - 26.
Proo/. 17 = 3*+4 - 2a+6 ^>
(2a - 1)26 = (3h - 1)34
54 | a and 162 + a
16 | o and
193 |316- 1 =>193 |2a- 1 =» 96 | a
32 + b
257 |216—1 =>257 13*—1 =>256 | b =>32 | b =*=
There is only one more presentation of 19 with pk = 3,
19 = 33 - 23.
Proof. 19 = 3fr+3 - 2a+3 =»
(2a- 1)23 = (3fc- 1)33
181a and 27 + a
2\b and 4 + 6
73 |29 - 1 =» 73 13fr- 1 =>12 | b =>4 | 6 ^=
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
202
R. K. GUY, C. B. LACAMPAGNE, AND J. L SELFRIDGE
There is only one more presentation of 23 with pk = 3,
23 = 25 - 32.
Proof. 23 = 2a +5- 3h+2^>
(2a - 1)25 = (3*- 1)32
6 | a and 9 + a
816 and 16 + 6
7|23 - 1 =>713a- 1 =^ 6 | ¿>=>24 | 6
73 1312- 1 => 73 12a- 1 =>9 | a =*=
This method can be extended to all N which are relatively prime to six and which
can be written in the form |2a + 3h |. (All TV< 103 except 53, 71 and 95.)
pk > 5. For pk > 5, we wrote two programs to find presentations. One starts with
fixed TVand uses the first k primes to consider all 2k possible cases, depending on
whether each prime is a factor of B or L. For each N and for each case, the program
finds the smallest B and L and increments them by the product of the first k
primes. Each such pair below the bound is checked, and if condition (5) is satisfied,
the presentation is listed.
The second program backtracks through the sums of the logarithms of nonzero
powers of primes < pk below the logarithm of the bound. For each pair of sums that
is equal (within a given epsilon), the program computes N and lists it if TV< p2k+ x.
For k small or for k large, the second program is faster.
Table 3 gives the smallest and largest B and the count of the number of
presentations found for each pk. Table 4 gives all presentations that we have found.
We remark that at least one presentation was found for each prime less than 232.
Notice the two "connected" presentations:
23 = 2048 - 2025= 2025 - 2002.
We have searched for presentations up to 1014. From this and from Table 4, the
reader can judge whether there are likely to be any presentations still outstanding.
We would like to thank Richard Blecksmith for helpful discussions about the
second program and for the use of his personal computer.
Mathematics and Statistics Department
University of Calgary
Calgary, Alberta, Canada T2N 1N4
Department
of Mathematics
The University of Michigan—Flint
Flint, Michigan 48502-2186
Department of Mathematical Sciences
Northern Illinois University
DeKalb, Illinois 60115
1. D. H. Lehmer, "On a problem of Stornier," IllinoisJ. Math., v. 8. 1964, pp. 59-79.
2. D. H. Lehmer,
"On the converse of Fermat's Theorem,"
Amer. Math. Monthly, v. 43, 1936, pp.
347-354.
3. John Brillhart,
D. H. Lehmer, J. L. Selfridge, Bryant Tuckerman & S. S. Wagstaff, Jr.,
Factorizations of b" + 1, b = 2,3,5,6,7,10,11,12
up to high powers, Contemp. Math., vol. 22, Amer.
Math. Soc, Providence, R. I., 1983.
License or copyright restrictions may apply to redistribution; see http://www.ams.org/journal-terms-of-use
© Copyright 2026 Paperzz