Determine the minimum value of a prime number P such that each of P-1 and P+1 has at least three distinct prime divisors.
clearvars,clc
p=1; ct=0;
while 1==1
p=nextprime(p+1);
div1=factortable(p-1);
div2=factortable(p+1);
if length(div1)>2 && length(div2)>2
disp([p-1 p p+1])
disp(factortable(p-1))
disp(' ')
disp(factortable(p+1))
disp(' ')
ct=ct+1;
if ct>=10
break
end
end
end
where factortable is
function ft=factortable(x)
f1=factor(x);
f1=f1';
[ft1, ft2]=groupcounts(f1);
ft=[ft1 ft2];
end
finds that 131 is the first such prime, surrounded by 130 = 2*5*13, and 132, which has 2 as a factor twice, as well as 3 and 11.
It is reported by the program in tabular form, showing the number of occurrences of each prime factor in the preceding and following integer:
130 131 132
2 1
5 1
13 1
2 2
3 1
11 1
the next nine such primes are:
138 139 140
2 1
3 1
23 1
2 2
5 1
7 1
180 181 182
2 2
3 2
5 1
2 1
7 1
13 1
228 229 230
2 2
3 1
19 1
2 1
5 1
23 1
238 239 240
2 1
7 1
17 1
2 4
3 1
5 1
280 281 282
2 3
5 1
7 1
2 1
3 1
47 1
306 307 308
2 1
3 2
17 1
2 2
7 1
11 1
310 311 312
2 1
5 1
31 1
2 3
3 1
13 1
348 349 350
2 2
3 1
29 1
2 1
5 2
7 1
372 373 374
2 2
3 1
31 1
2 1
11 1
17 1
Expanding the requirement to four distinct primes:
1428 1429 1430
2 2
3 1
7 1
17 1
2 1
5 1
11 1
13 1
3190 3191 3192
2 1
5 1
11 1
29 1
2 3
3 1
7 1
19 1
3540 3541 3542
2 2
3 1
5 1
59 1
2 1
7 1
11 1
23 1
3738 3739 3740
2 1
3 1
7 1
89 1
2 2
5 1
11 1
17 1
4002 4003 4004
2 1
3 1
23 1
29 1
2 2
7 1
11 1
13 1
4420 4421 4422
2 2
5 1
13 1
17 1
2 1
3 1
11 1
67 1
4522 4523 4524
2 1
7 1
17 1
19 1
2 2
3 1
13 1
29 1
4690 4691 4692
2 1
5 1
7 1
67 1
2 2
3 1
17 1
23 1
4758 4759 4760
2 1
3 1
13 1
61 1
2 3
5 1
7 1
17 1
5278 5279 5280
2 1
7 1
13 1
29 1
2 5
3 1
5 1
11 1
|
Posted by Charlie
on 2022-10-15 11:06:49 |