login
The least prime p of three consecutive primes p,q,r such that q - p = 2n + 2 and r - q = 2n.
0

%I #12 Mar 05 2026 22:15:50

%S 7,31,359,691,619,7043,1831,4603,40193,43669,29077,16007,114913,

%T 165103,202409,334897,370723,981983,321469,250501,1256063,1980991,

%U 3137263,2890763,3861607,1199203,1683113,2280709,10016563,4221047,21570253,2401741,14527553,6750259,43104631,52744103

%N The least prime p of three consecutive primes p,q,r such that q - p = 2n + 2 and r - q = 2n.

%C The sequence is not monotonic.

%C These primes are not balanced (A006562). But that does not preclude A096693(a(n)) from not being 0. Case in point is A096693(a(3)) = 1.

%e a(1) = 7 since 7, 11, 13 have differences of 4 and 2;

%e a(2) = 31 since 31, 37, 41 have differences of 6 and 4;

%e a(3) = 359 since 359, 367, 373 have differences of 8 and 6;

%t p = 2; q = 3; r = 5; t[_] := 0; While[p < 53000000, If[r + p + 2 == 2 q && t[(r - q)/2] == 0, t[(r - q)/2] = p]; {p, q, r} = {q, r, NextPrime[r]}]; t /@ Range@36

%o (PARI) upto(lim)={my(L=List([0]), d=0, q=5); forprime(p=7, lim, if(p-q==2*d, while(#L<=d, listput(L,0)); if(!L[d], L[d]=q-2-2*d)); d=(p-q)/2-1; q=p); my(k=1); while(L[k], k++); Vec(L[1..k-1])} \\ _Andrew Howroyd_, Feb 27 2026

%o (Python)

%o from gmpy2 import next_prime

%o from itertools import islice

%o def agen(): # generator of terms

%o adict, n = {None: None}, 1

%o p, q, r = 2, 3, 5

%o while True:

%o p, q, r = q, r, next_prime(r)

%o v = (r-q)//2 if q-p == r-q + 2 else None

%o if v not in adict:

%o adict[v] = int(p)

%o while n in adict: yield adict[n]; n += 1

%o print(list(islice(agen(), 34))) # _Michael S. Branicky_, Feb 28 2026

%Y Cf. A006562, A075540, A096693, A282707, A283145.

%K nonn

%O 1,1

%A _Robert G. Wilson v_, Feb 27 2026