login
Decimal expansion of the alternating sum 1/p(1) - 1/(p(2)*p(3)) + 1/(p(4)*p(5)*p(6)) - 1/(p(7)*p(8)*p(9)*p(10)) + ..., where p(n) is the n-th prime.
1

%I #17 Aug 12 2014 03:18:02

%S 4,3,4,3,2,7,7,0,3,1,9,6,9,3,8,1,0,2,2,9,6,1,5,7,5,1,3,0,2,4,8,3,7,2,

%T 3,6,7,4,2,7,9,1,3,8,9,2,7,7,1,9,6,7,7,9,3,8,5,5,2,6,0,1,4,1,4,4,2,1,

%U 1,5,0,5,4,1,6,0,9,4,6,8,0,4,0,7,3,8,9,6,1,9,8,6,8,6,1,4,2,9,1,5,2,7,8,5,7

%N Decimal expansion of the alternating sum 1/p(1) - 1/(p(2)*p(3)) + 1/(p(4)*p(5)*p(6)) - 1/(p(7)*p(8)*p(9)*p(10)) + ..., where p(n) is the n-th prime.

%C Absolute difference between this number and A139395 is about 0.1333426...

%e 0.4343277031969381022961575130248372367427913892771967793855...

%p P:=proc(n) local a, b, i, j, k; a:=0.5; k:=1; for i from 2 by 1 to n do b:=1; for j from k by 1 to k+i-1 do b:=b*1/ithprime(j+1); od; k:=j; a:=evalf(a+b*(-1)^(i-1), 105); od; print(a); end: P(100);

%t digits = 105; n0 = 10; dn = 10; t[n_] := n*(n + 1)/2; Clear[p]; p[n_] := p[n] = Sum[(-1)^(k + 1)/Product[Prime[j], {j, t[k] - k + 1, t[k]}], {k, 1, n}] // N[#, digits] &; p[n0]; p[n = n0 + dn]; While[RealDigits[p[n]] != RealDigits[p[n - dn]], Print["n = ", n]; n = n + dn]; RealDigits[p[n], 10, digits] // First (* _Jean-François Alcover_, Aug 12 2014, adapted from PARI *)

%o (PARI) default(realprecision, 120);

%o T(n) = n*(n + 1)/2; \\ T(n) = A000217(n).

%o sum(k = 1, 100, (-1.)^(k-1)/prod(j = T(k) - k + 1, T(k), prime(j))) \\ _Rick L. Shepherd_, Mar 07 2014

%Y Cf. A139395, A139396.

%K nonn,cons,easy

%O 0,1

%A _Paolo P. Lava_, Feb 27 2014 - following a suggestion of _Jean-François Alcover_.

%E More terms from and offset corrected by _Rick L. Shepherd_, Mar 07 2014