login
A305748
Distance of a prime number from the average of the next two consecutive prime numbers.
2
2, 3, 4, 5, 4, 5, 4, 7, 7, 5, 8, 5, 4, 7, 9, 7, 5, 8, 5, 5, 8, 7, 10, 10, 5, 4, 5, 4, 11, 16, 7, 7, 7, 11, 5, 9, 8, 7, 9, 7, 7, 11, 4, 5, 8, 18, 14, 5, 4, 7, 7, 7, 13, 9, 9, 7, 5, 8, 5, 7, 17, 16, 5, 4, 11, 17, 11, 11, 4, 7, 10, 11, 9, 8, 7, 10, 10, 8, 13, 11, 7, 11, 5, 8, 7, 10, 10, 5, 4, 10, 16, 10, 8, 10, 7, 12, 13
OFFSET
1,1
FORMULA
a(n) = A024675(n) - A000040(n).
EXAMPLE
For n=4 prime(4) = 7. The next two primes are 11, 13 and the average (11 + 13) / 2 = 12. So 12 - 7 = 5 and a(4) = 5.
MATHEMATICA
Map[Mean@ Rest@ # - First@ # &, Partition[Prime@ Range@ 99, 3, 1]] (* Michael De Vlieger, Jun 11 2018 *)
PROG
(PARI) { forprime(n = 2, 100, p1 = nextprime(n+1); p2 = nextprime(p1 + 1);
print1((p1 + p2) / 2 - n", ")) }
CROSSREFS
Sequence in context: A291520 A354445 A317646 * A302981 A205785 A303235
KEYWORD
nonn,easy
AUTHOR
Dimitris Valianatos, Jun 09 2018
STATUS
approved