OFFSET
2,10
COMMENTS
If {prime(n), prime(n+1)} are twin primes, then a(n) = 2*prime(n)+2 = 0 mod 4.
The number of 2's up to n = 2^k, k >= 1, is (0, 0, 0, 1, 4, 9, 30, 72, 162, 346, 779, 1596, 3333, 6867, 13987, 28229,...). Between n = 2^5 and n = 2^16, the percentage of 2's increases from 12.5% to 43%. - M. F. Hasler, Jun 06 2017
LINKS
M. F. Hasler, Table of n, a(n) for n = 2..10000
MAPLE
a:=proc(n) local k: k:=(ithprime(n+1)-ithprime(n))/2: ithprime(n)+ithprime(n+k) mod 4 end: seq(a(n), n=2..130); # Emeric Deutsch, May 31 2005
MATHEMATICA
Table[Mod[Prime[n]+Prime[n+(Prime[n+1]-Prime[n])/2], 4], {n, 2, 120}] (* Harvey P. Dale, Jun 30 2020 *)
PROG
(PARI) a(n)=(prime(n+(prime(n+1)-n=prime(n))/2)+n)%4 \\ M. F. Hasler, May 12 2016
(PARI) {S=0; L=n=1; o=3; forprime(p=4, , S+=(o+prime((-o+o=p)\2+n++))%4; n<L||print1(S", ")||L*=2)} \\ Slightly optimized to compute partial sums up to n = 2^k. - M. F. Hasler, Jun 06 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Yasutoshi Kohmoto, Jan 27 2005
EXTENSIONS
More terms from Emeric Deutsch, May 31 2005
STATUS
approved