OFFSET
2,1
COMMENTS
This sequence has to do with the relative position of primes with respect to their adjacent primes:
(i) if prime(n) is closer to its predecessor than to its successor, then a(n) = 2*prime(n);
(ii) if prime(n) is closer to its successor than to its predecessor, then a(n) = 2*prime(n) - prime(n-1) - prime(n+1); and
(iii) if prime(n) is equidistant from its predecessor and its successor, then a(n) = 0.
Is lim_{n -> infinity} (Sum_{i=1..n} a(i))/(Sum_{i=1..n} prime(i)) finite? If so, what is its value?
LINKS
Harvey P. Dale, Table of n, a(n) for n = 2..1000
MAPLE
seq(modp(2*ithprime(n), (ithprime(n-1)+ithprime(n+1))), n=2..90); # Muniru A Asiru, Oct 07 2018
MATHEMATICA
Table[Mod[2*Prime[n], Prime[n-1] + Prime[n+1]], {n, 2, 120}]
Mod[2#[[2]], #[[1]]+#[[3]]]&/@Partition[Prime[Range[90]], 3, 1] (* Harvey P. Dale, Jan 03 2019 *)
PROG
(PARI) a(n) = 2*prime(n) % (prime(n-1) + prime(n+1)); \\ Michel Marcus, Oct 18 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Andres Cicuttin, Oct 06 2018
STATUS
approved