%I #68 Dec 10 2019 12:04:09
%S 1,1,2,2,5,4,5,4,5,6,10,9,8,5,8,7,15,12,14,17,12,15,11,16,16,18,13,14,
%T 14,21,45,29,34,26,32,25,25,25,22,20,26,20,32,24,33,23,38,48,36,34,40,
%U 30,31,30,37,31,33,39,37,38,32,48,41,44,36,52,54,43,43,51
%N a(n) is the number of integers k > prime(n) such that all rows (after the initial row) of the triangle of absolute differences of the (n+1)-tuple (prime(1), ..., prime(n), k) all start with 1.
%C Suggested by Gilbreath's conjecture (see A036262).
%C The sequence of primes considered in Gilbreath's conjecture is just one possibility out of all the sequences that can be generated starting from (2,3,...,prime(n)).
%C Conjecture: Prime(n+1) is always between prime(n)+2 and prime(n)+2*a(n).
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/GilbreathsConjecture.html">Gilbreath's Conjecture</a>
%F Given the sequence of primes S = (2,3,5,...,prime(n)) and the triangle of the forward absolute differences of S, let d(r) be the last rightmost absolute difference of row r, for r>1. Then a(n) = (1+ Sum_{r>1} d(r)) / 2.
%e a(1) = 1, because considering the sequence (2,k), k=3 is the only solution.
%e a(2) = 1, because considering the sequence (2,3,k), k=5 is the only solution.
%e To calculate a(3), consider the sequence (2,3,5) and calculate the triangle of absolute differences:
%e 2,3,5
%e 1,2
%e 1
%e Consider the rightmost diagonal, which contains the absolute differences (2,1), then a(3) is given by a(3) = [(2+1) + 1]/2 = 2.
%e That is, a(3) is the result of summing the two differences contained in the rightmost diagonal (2,1). To this sum we add 1 and divide the total by 2.
%e So there are 2 integers k > prime(3) = 5 -- namely, 7,9 -- such that the forward absolute differences of (2,3,5,k) start with 1.
%e To be explicit, there are two triangles of absolute differences resulting from (2,3,5,k), namely
%e 2 3 5 7
%e 1 2 2
%e 1 0
%e 1
%e and
%e 2 3 5 9
%e 1 2 4
%e 1 2
%e 1
%e a(24) = 16 because there are 16 integers k > prime(25) = 97 -- namely, 99,101,...,129 -- such that all rows (after the first row) of the triangle of absolute differences of (2,3,5,7,11,13,17,...,97,k) start with 1.
%o (Python)
%o # run the function find_M(n), where n is the last prime number of your list of consecutive primes starting from 2
%o from sympy import isprime
%o def primes_less_N(n):
%o primes = []
%o for i in range(2,n+1):
%o if(isprime(i)==True):
%o primes.append(i)
%o return primes
%o def find_M(n):
%o primes = primes_less_N(n)
%o l = len(primes)
%o count = 1
%o if count == 1:
%o a = [abs(x - primes[i - 1]) for i, x in enumerate(primes)][1:]
%o count += 1
%o list_f = []
%o if count > 1:
%o while count <l+1:
%o list_f.append(a[len(a)-1])
%o b = [abs(x - a[i-1]) for i, x in enumerate(a)][1:]
%o a=b
%o count +=1
%o return (sum(list_f)+1)/2
%o (PARI) diffs(v) = {while (#v != 1, v = vector(#v-1, k, abs(v[k+1] - v[k]));); v[1];}
%o a(n) = {my(v = primes(n), m = vecmax(v)+1, nb = 0); if (!(m%2), m++); forstep (k=m, oo, 2, if (diffs(concat(v, k)) == 1, nb++, if (nb, break));); nb;} \\ _Michel Marcus_, Dec 03 2019
%Y Cf. A036262, A036261.
%K nonn
%O 1,3
%A _Fabio Mercurio_, Nov 27 2019