login
a(n) = 2*prime(n) modulo (prime(n-1) + prime(n+1)).
1

%I #53 Jan 03 2019 18:04:49

%S 6,0,14,2,26,2,38,46,4,62,2,2,86,94,0,4,122,2,2,146,2,166,178,4,2,206,

%T 2,218,226,10,262,4,278,8,302,0,2,334,0,4,362,8,386,2,398,0,8,2,458,

%U 466,4,482,4,0,0,4,542,2,2,566,586,10,2,626,634,8,674,8,698,706,718,2,0,2,766,778,4,802,818,8,842

%N a(n) = 2*prime(n) modulo (prime(n-1) + prime(n+1)).

%C This sequence has to do with the relative position of primes with respect to their adjacent primes:

%C (i) if prime(n) is closer to its predecessor than to its successor, then a(n) = 2*prime(n);

%C (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

%C (iii) if prime(n) is equidistant from its predecessor and its successor, then a(n) = 0.

%C Is lim_{n -> infinity} (Sum_{i=1..n} a(i))/(Sum_{i=1..n} prime(i)) finite? If so, what is its value?

%H Harvey P. Dale, <a href="/A320146/b320146.txt">Table of n, a(n) for n = 2..1000</a>

%p seq(modp(2*ithprime(n),(ithprime(n-1)+ithprime(n+1))),n=2..90); # _Muniru A Asiru_, Oct 07 2018

%t Table[Mod[2*Prime[n], Prime[n-1] + Prime[n+1]], {n, 2, 120}]

%t Mod[2#[[2]],#[[1]]+#[[3]]]&/@Partition[Prime[Range[90]],3,1] (* _Harvey P. Dale_, Jan 03 2019 *)

%o (PARI) a(n) = 2*prime(n) % (prime(n-1) + prime(n+1)); \\ _Michel Marcus_, Oct 18 2018

%Y Cf. A000040, A001223, A006562, A274263, A276309.

%K nonn

%O 2,1

%A _Andres Cicuttin_, Oct 06 2018