%I #14 Dec 18 2016 01:37:02
%S 1,3,6,4,10,6,14,8,18,12,23,15,29,17,33,21,40,24,45,28,49,31,55,35,63,
%T 40,67,42,71,44,81,52,87,55,94,60,99,65,105,69,112,72,119,77,123,79,
%U 131,90,140,92,144,96,149,101,158,106,165,109,170,113,174,118,187,126,191
%N a(n) = 2 + Sum_{x=n..prime(n)} (-x*(-1)^x).
%H G. C. Greubel, <a href="/A163294/b163294.txt">Table of n, a(n) for n = 1..1000</a>
%e a(1) = 2 + 1 - 2 = 1;
%e a(2) = 2 - 2 + 3 = 3;
%e a(3) = 2 + 3 - 4 + 5 = 6;
%e a(4) = 2 - 4 + 5 - 6 + 7 = 4;
%e a(5) = 2 + 5 - 6 + 7 - 8 + 9 - 10 + 11 = 10.
%p A163294 := proc(n) 2+add( -j*(-1)^j, j=n..ithprime(n)) ; end: seq(A163294(n),n=1..120) ; # _R. J. Mathar_, Oct 10 2009
%t Table[2 + Sum[k*(-1)^(k + 1), {k, n, Prime[n]}], {n,1,100}] (* _G. C. Greubel_, Dec 17 2016 *)
%o (PARI) for(n=1, 50, print1(2 + sum(k=n, prime(n), k*(-1)^(k+1)), ", ")) \\ _G. C. Greubel_, Dec 17 2016
%Y Cf. A000027, A000040.
%K nonn,less
%O 1,2
%A _Juri-Stepan Gerasimov_, Jul 24 2009
%E Corrected by _Juri-Stepan Gerasimov_, Jul 26 2009
%E Edited (but not checked) by _N. J. A. Sloane_, Jul 27 2009
%E Roughly 50 percent of the entries corrected by _R. J. Mathar_, Oct 10 2009