%I #70 Mar 19 2020 14:40:38
%S 8,4,8,1,3,2,2,1,1,8,7,6,9,8
%N Decimal expansion of the sum of the alternating series of reciprocals of nonprime numbers.
%C From _Jon E. Schoenfield_, Nov 10 2016: (Start)
%C Let S(j) be the partial sum through the j-th term of the alternating series, i.e., S(j) = -Sum_{m=1..j} (-1)^m/A018252(m). The sequence of real values S(2*i-1) for i >= 1, i.e., of partial sums 1/1, 1/1 - 1/4 + 1/6, 1/1 - 1/4 + 1/6 - 1/8 + 1/9, ... (each of which ends with a positive term) will approach the limit from above, while the sequence of real values S(2*i) for i >= 1, i.e., of partial sums 1/1 - 1/4, 1/1 - 1/4 + 1/6 - 1/8, 1/1 - 1/4 + 1/6 - 1/8 + 1/9 - 1/10, ... (each of which ends with a negative term) will approach the limit from below. Let S'(j) = (S(j-1) + S(j))/2; equivalently, S'(j) = -(Sum_{m=1..j-1} (-1)^m/A018252(m) + (1/2)*(-1)^j/A018252(j)), so S'(j) can be viewed as an adjusted version of S(j), adjusted by using only half of the final term of S(j). At large values of j, successive values of S'(j) will fluctuate very little compared to the differences between successive values of S(j), because the averaging of successive values of S(j), which are above the limit at each odd value of j and below the limit by very nearly the same amount at each even value of j, causes the values of S'(j) to trace a path midway between that traced by the S(j) values for odd j and those for even j.
%C Moreover, it can be observed (see the charts under Links) that the values of S'(j) themselves fall into three sharply distinct real-valued subsequences: one that converges toward the limit from above and consists of those values where both j and the j-th nonprime number (i.e., the reciprocal of the last term in S(j)) are even; one that converges toward the limit from below and consists of those values where j is odd and the j-th nonprime number is even; and one that stays very near the middle, converging even more rapidly toward the limit, and consisting of all those values where the j-th nonprime number is odd (regardless of the parity of j). The values in this last subsequence converge so rapidly that the first 1000 or so terms are sufficient to show that the limit is clearly 0.848132..., with the next digit very likely another 2. Using the first 10^7 terms, it becomes apparent ("zoomed in" more closely than in the 3-curve chart under Links) that the limit is 0.8481322118769887..., and having observed the behavior of this last subsequence out to nearly j=3*10^9, I am confident that the limit is 0.84813221187698878102544...
%C But how many of these digits can be rigorously proved? (End)
%C From _Robert Price_, Nov 13 2016: (Start)
%C To support the comments above by Jon Schoenfield: The sum of an alternating arithmetic sequence whose terms are decreasing in absolute value will always converge. The method he has outlined, we might call the "Schoenfield Interpolation". To illustrate further and to confirm his method, the simpler sum: log(2) = 1/1 - 1/2 + 1/3 - 1/4 + ... can be calculated with the following Mathematica program. Note that after only 20,000 iterations, needing only a few seconds, the limit can be obtained to 13 digits.
%C sum = 0;
%C iter = 20000;
%C For[i=1,i<=iter,i=i+2,
%C sum = sum + 1/i;
%C upper = sum;
%C If[i>iter-10,avg1=(upper+lower)/2;Print[N[{upper,lower,avg1,(avg1+avg2)/2},15]]];
%C sum = sum - 1/(i+1);
%C lower = sum;
%C If[i>iter-10,avg2=(upper+lower)/2;Print[N[{upper,lower,avg2,(avg1+avg2)/2},15]]];
%C ];
%C N[Log[2],15]
%C {0.693172191189447,0.693122168679318,0.693147179934382,0.693147181497164}
%C {0.693172191189447,0.693122171181444,0.693147181185446,0.693147180559914}
%C {0.693172188687571,0.693122171181444,0.693147179934508,0.693147180559977}
%C {0.693172188687571,0.693122173683070,0.693147181185320,0.693147180559914}
%C {0.693172186186196,0.693122173683070,0.693147179934633,0.693147180559977}
%C {0.693172186186196,0.693122176184195,0.693147181185195,0.693147180559914}
%C {0.693172183685320,0.693122176184195,0.693147179934758,0.693147180559977}
%C {0.693172183685320,0.693122178684820,0.693147181185070,0.693147180559914}
%C {0.693172181184945,0.693122178684820,0.693147179934883,0.693147180559977}
%C {0.693172181184945,0.693122181184945,0.693147181184945,0.693147180559914}
%C 0.693147180559945
%C (End)
%H Jon E. Schoenfield, <a href="/A275712/a275712_2.png">Chart showing the rapid convergence of the "adjusted sums" S'(j)</a> (regardless of the parity of j or of the j-th nonprime) as compared to the unadjusted sums S(j) as described in Comments
%H Jon E. Schoenfield, <a href="/A275712/a275712_3.png">Chart showing the very rapid convergence of the "adjusted sums" S'(j), and highlighting the especially rapid convergence of the subsequence of such sums for which the j-th nonprime is odd</a>
%F -Sum_{k>=1} (-1)^k/A018252(k) = 1/1 - 1/4 + 1/6 - 1/8 + 1/9 - 1/10 + 1/12 - ...
%F Equals 1 - A269229.
%e 0.84813221187698...
%t NonPrime[n_] := FixedPoint[n + PrimePi@# &, n + PrimePi@n]; N[Sum[(-1)^n/NonPrime[n], {n, 1, 200}], 25] (* _G. C. Greubel_, Aug 06 2016 *)
%o (Sage)
%o nonprime = (i for i in NN if i>0 and not i.is_prime())
%o s = RLF(0); s
%o RealField(110)(s)
%o for i in range(0, 50000): s += (-1)^i / next(nonprime)
%o print(s) # _Terry D. Grant_, Aug 06 2016
%Y Cf. A078437, A018252, A269229.
%K nonn,cons,more
%O 0,1
%A _Terry D. Grant_, Aug 06 2016
%E Incorrect terms a(7)-a(10) deleted, and corrected terms a(7)-a(9) added, by _Robert Price_, Nov 09 2016
%E a(10)-a(13) from _Robert Price_, Nov 13 2016