OFFSET
1,1
COMMENTS
a(n) = -4 only when prime(n) is the smaller of a twin prime pair or prime(1) = 2 where a(1) = 2*3-2^2-2*3 = -4.
Let g be the gap between prime(n) and prime(n + 1) i.e. g = q - p. Then a(n) = (g - 2) * p - 2 * g = (A001223(n) - 2) * A000040(n) - 2 * A001223(n). - David A. Corneth, Jun 06 2016
EXAMPLE
For n=5, p = prime(5) = 11, q = prime(6) = 13, a(5) = 11*13-11^2-2*13 = -4.
For n=6, p = prime(6) = 13, q = prime(7) = 17, a(6) = 13*17-13^2-2*17 = 18.
MATHEMATICA
Table[Prime@ n Prime[n + 1] - Prime[n]^2 - 2 Prime[n + 1], {n, 54}] (* Michael De Vlieger, Jun 04 2016 *)
PROG
(PARI) forprime(p=1, 300, q=nextprime(p+1); print1(p*q-p^2-2*q, ", "))
(PARI) p=2; forprime(q=3, 1e3, print1(p*(q-p)-2*q", "); p=q) \\ Charles R Greathouse IV, Jun 10 2016
CROSSREFS
KEYWORD
sign
AUTHOR
Dimitris Valianatos, Jun 03 2016
STATUS
approved