OFFSET
1,29
COMMENTS
r(n) is the second difference of the primes (A036263(n)) divided by the second sum (A031131(n)); equivalently r(n) = (g_next - g_prev)/(g_next + g_prev), where g_prev and g_next are the prime gaps on either side of prime(n+1). -1 < r(n) < 1 for all n, since |g_next - g_prev| < g_next + g_prev for positive gaps; the bounds +-1 are never attained. (Provable.)
r(n) = 0 if and only if prime(n+1) is a balanced prime (A006562), i.e. g_prev = g_next. (Provable.) Two primes with equal second difference (A036263) need not have equal r(n), so r(n) distinguishes primes more finely than A036263 alone.
The author calls r(n) the "second ratio" of a prime.
LINKS
Edward Bernstein, Table of n, a(n) for n = 1..10000
Edward Bernstein, Drift of r(n) across prime neighborhood scales
FORMULA
EXAMPLE
n=1: primes 2, 3, 5; gaps 1 and 2; (2-1)/(2+1) = 1/3, so a(1) = 1.
n=2: primes 3, 5, 7; gaps 2 and 2; 0/4 = 0/1, so a(2) = 0.
n=9: primes 23, 29, 31; gaps 6 and 2; (2-6)/(6+2) = -4/8 = -1/2, so a(9) = -1.
MAPLE
seq(numer((ithprime(n+2)-2*ithprime(n+1)+ithprime(n))/(ithprime(n+2)-ithprime(n))), n=1..70);
MATHEMATICA
a[n_] := Numerator[(Prime[n+2] - 2 Prime[n+1] + Prime[n])/(Prime[n+2] - Prime[n])]; Array[a, 80]
PROG
(PARI) a(n) = my(p=prime(n), q=prime(n+1), r=prime(n+2)); numerator((r-2*q+p)/(r-p));
CROSSREFS
KEYWORD
sign,frac,easy
AUTHOR
Edward Bernstein, May 19 2026
STATUS
approved
