On April 23, 2018. Jan van Delden wrote:
I found 4 solutions with frequency 4, in order of increasing p:
D = 315450085755 p: 10515002837 14338640237 52575014279
D = 352944565575 p: 19608031393 35294456513 58824094249
D = 724991548725 p: 27884290321 120831924751 362495774257
D = 1070088032385 p: 31473177371 178348005149 178348005361
With the notation of Walter Trump: D
= p(b – a)+T(b – 1)+T(a – 1).
At first I tried to remember the computed values of D, sort them,
and remove the tail using D(minimal)=2p+7, as suggested by Emmanuel.
But even if one restricts adding values to this list if b is “larger
than some value” the list grows rather fast and hence the sorting
and inserting of new values of D takes more and more time.
Restricting on |b-a| is a better idea, which I didn’t try.
I decided to compute D, given p, and use the fact that |b-a|
decreases with increasing p. So loop on all possible a1,b1 with
|b1-a1| bounded by |b-a|, the value computed for the intial
p,|b1-a1|<=|b-a|. And finally check that the gaps a1 and b1 belong
to the corresponding new value p1 (which should be prime..).
The disadvantage is that several D are computed more than once, but
since solutions with frequency > 1 are relatively rare the speed
increases considerably. Looping on |b-a| downwards to 2 has the
advantage that it is possible to spot whether this value of D has
been detected before and prevent output in such a case.
These solutions might not be the first solutions (unfortunately).
I used that |b1-a1|<=|b-a| if p1>p. In order to reduce computing
time I presumed that we also have b1<=b.
Sometimes this is not true (d=b-a):
D=181231155345 p: 18123115511 [a=10,b=20,d=10] 30205192309
[a=36,b=42,d=6] 90615577669 [a=2,b=4,d=2]
If that happens my routine is not capable of finding this solution
at the first occasion, when p=18123115511, because for this p it
would use the bound b1<=20, which clearly doesn’t apply for the
second prime in the sequence. However, since I was afraid something
like this would happen I allowed a wider range: |b1-a1|<=|b-2|,
instead of |b-a| which equals 42-2=40 for the second prime. And now
all three primes fulfil my criteria.
So there might be solutions smaller than the ones given by me. But
this seems difficult to circumvent without wasting a lot of
computing time on non-solutions.