login
A396239
Numerator of r(n) = (prime(n+2) - 2*prime(n+1) + prime(n)) / (prime(n+2) - prime(n)).
2
1, 0, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 0, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 5, -5, 1, -1, 2, -2, 1, 0, -1, 1, 0, -1, 2, -2, 1, -1, 5, 0, -1, -1, 1, 1, -1, 2, -1, 0, 0, -1, 1, -1, -1, 2, 1, -5, -1, 1, 5, -2, 1, -2, 1, 1, 1, -1, 0, -1, 1, 1, -1, 1, 1, -2
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.
FORMULA
a(n) = numerator(A036263(n) / A031131(n)).
a(n) = A036263(n) / gcd(A036263(n), A031131(n)) when A036263(n) <> 0, otherwise a(n) = 0.
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
Cf. A396240 (denominators), A036263 (second difference, the raw numerator), A031131 (second sum, the raw denominator), A001223 (prime gaps), A006562 (balanced primes).
Sequence in context: A046585 A046584 A046599 * A100285 A172355 A178916
KEYWORD
sign,frac,easy
AUTHOR
Edward Bernstein, May 19 2026
STATUS
approved