login
Primes that are at the end of the local maxima in the sequence of consecutive prime gaps.
0

%I #35 Jul 06 2025 18:49:47

%S 11,17,29,37,67,79,97,107,127,137,149,191,197,239,251,277,307,331,347,

%T 367,397,419,431,439,457,479,499,521,541,557,587,631,673,701,719,751,

%U 769,787,809,821,827,853,877,907,929,967,991,1009,1019,1031,1049,1061,1087

%N Primes that are at the end of the local maxima in the sequence of consecutive prime gaps.

%C This sequence lists the larger prime in each consecutive prime pair where the difference is a local maximum in the sequence of prime gaps.

%C A local maximum occurs when p(n)-p(n-1) < p(n+1)-p(n) > p(n+2)-p(n+1) where p(n) is the n-th prime.

%F a(n) = prime(A198696(n)+1). - _Michel Marcus_, Jul 01 2025

%e The primes 7 and 11 differ by 4, which is larger than the previous gap (2) and the next gap (2). So 11 is in the sequence.

%t Module[{primes = Prime[Range[1, 200]], diffs, res = {}}, diffs = Differences[primes];

%t Do[If[diffs[[i]] > diffs[[i - 1]] && diffs[[i]] > diffs[[i + 1]],

%t AppendTo[res, primes[[i + 1]]]], {i, 2, Length[diffs] - 1}]; res]

%o (Python)

%o from sympy import primerange

%o primes = list(primerange(2, 2000))

%o diffs = [primes[i+1] - primes[i] for i in range(len(primes)-1)]

%o local_max_asals = []

%o for i in range(1, len(diffs)-1):

%o if diffs[i] > diffs[i-1] and diffs[i] > diffs[i+1]:

%o local_max_asals.append(primes[i+1])

%o print(local_max_asals[:70])

%Y Cf. A001223 (prime gaps), A198696.

%K nonn,easy

%O 1,1

%A _Emirhan Üçok_, Jun 29 2025