

A008347


a(n) = Sum_{i=0..n1} (1)^i * prime(ni).


26



0, 2, 1, 4, 3, 8, 5, 12, 7, 16, 13, 18, 19, 22, 21, 26, 27, 32, 29, 38, 33, 40, 39, 44, 45, 52, 49, 54, 53, 56, 57, 70, 61, 76, 63, 86, 65, 92, 71, 96, 77, 102, 79, 112, 81, 116, 83, 128, 95, 132, 97, 136, 103, 138, 113, 144, 119, 150, 121, 156, 125, 158, 135, 172, 139, 174, 143
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,2


COMMENTS

Define the sequence b(n) by b(1) = 1; b(n) = 1  (prime(n1)/prime(n))*b(n1) if n > 1. Then b(n) = a(n)/prime(n). Does lim b(n) exist? If so, it must equal 1/2.  Joseph L. Pe, Feb 17 2003
This sequence contains no duplicate values; after the initial 0, 2, the parity alternates, and a(n+2) > a(n). Do even and odd values trade the lead infinitely often (as would be expected if we model their difference as a random walk)?  Franklin T. AdamsWatters, Jan 25 2010
Conjecture: For any m = 1, 2, 3, ... and r = 0, ..., m  1, there are infinitely many positive integers n with a(n) == r (mod m).  ZhiWei Sun, Feb 27 2013
From ZhiWei Sun, May 18 2013: (Start)
Conjectures:
(i) The sequence a(1), a(2), a(3), ... contains infinitely many Sophie Germain primes (A005384). (For example, a(1) = 2, a(4) = 3, a(6) = 5, a(18) = 29, a(28) = 53, a(46) = 83, a(54) = 113 and a(86) = 191 are Sophie Germain primes.) Also, there are infinitely many positive integers n such that a(n)  1 and a(n) + 1 are twin primes. (Such integers n are 3, 7, 11, 41, 53, 57, 69, 95, 147, 191, 253, ....)
(ii) For each nonconstant integervalued polynomial P(x) with positive leading coefficient, there are infinitely many positive integers n such that a(n) = P(x) for some positive integer x. (For example, a(2) = 1^2, a(3) = 2^2, a(9) = 4^2, a(26) = 7^2, a(44) = 9^2, a(55) = 12^2 and a(58) = 11^2 are squares.)
(iii) The only powers of two in the current sequence are a(1) = 2, a(2) = 1, a(3) = 4, a(5) = 8, a(9) = 16, a(17) = 32, a(47) = 128, and a(165) = 512.
(iv) The only solutions to the equation a(n) = m! are (m,n) = (1, 2), (2, 1), (8, 7843). [False!] (End)
Conjecture: For any n > 9 we have a(n+1) < a(n1)^(1+2/(n+2)). (This yields an upper bound for prime(n+1)  prime(n) in terms of prime(1), ..., prime(n1). The conjecture has been verified for n up to 10^8.)  ZhiWei Sun, Jun 09 2013
a(n+2)  a(n) = A001223(n+1).  Reinhard Zumkeller, Feb 09 2015
Conjecture (iv) above is false since a(1379694977463) = 20922789888000 = 16!.  Giovanni Resta, Sep 04 2018
Conjecture: We have {a(m)+a(n): m,n>0} = {2,3,...}. Also, {a(m)a(n): m,n>0} contains all the integers, and {a(m)/a(n): m,n>0} contains all the positive rational numbers. (I have noted that {a(m)/a(n): m,n = 1..60000} contains {a/b: a,b = 1..1000}.)  ZhiWei Sun, May 23 2019


LINKS

N. J. A. Sloane, Table of n, a(n) for n = 0..30000 [Updated Dec 18 2019. First 2000 terms from T. D. Noe, first 10000 terms from Robert G. Wilson v]
Romeo Meštrovic, On the distribution of primes in the alternating sums of consecutive primes, arXiv:1805.11657 [math.NT], 2018.
ZhiWei Sun, On functions taking only prime values, J. Number Theory 133(2013), no.8, 27942812.
ZhiWei Sun, On a sequence involving sums of primes, Bull. Aust. Math. Soc. 88(2013), 197205.


FORMULA

a(n) = prime(n)  a(n1) for n>=1.
G.f: (x*b(x))/(1+x), where b(x) is the g.f. of A000040.  Mario C. Enriquez, Dec 10 2016
Meštrovic (2018), following Pillai, conjectures that
a(2k) = k*log k + k*loglog k  k + o(k) as k > oo,
with a similar conjecture for a(2k+1).  N. J. A. Sloane, Dec 21 2019


MAPLE

A008347 := proc(n) options remember; if n = 0 then 0 else abs(A008347(n1)ithprime(n)); fi; end;


MATHEMATICA

Join[{0}, Abs[Accumulate[Times@@@Partition[Riffle[Prime[Range[80]], {1, 1}], 2]]]] (* Harvey P. Dale, Dec 11 2011 *)
f[n_] := Abs@ Sum[(1)^k Prime[k], {k, n  1}]; Array[f, 70] (* Robert G. Wilson v, Oct 08 2013 *)
a[0] = 0; a[n_] := a[n] = Prime[n]  a[n  1]; Array[a, 70, 0] (* Robert G. Wilson v, Oct 16 2013 *)


PROG

(Haskell)
a008347 n = a008347_list !! n
a008347_list = 0 : zipWith () a000040_list a008347_list
 Reinhard Zumkeller, Feb 09 2015
(PARI) a(n)=abs(sum(i=1, n, (1)^i*prime(i))) \\ Charles R Greathouse IV, Apr 29 2015
(MAGMA) [0] cat [&+[ (1)^k * NthPrime(nk): k in [0..n1]]: n in [1..70]]; // Vincenzo Librandi, May 26 2019


CROSSREFS

Complement is in A226913.
Cf. A000040, A001223, A005384, A007504, A181901.
Sequence in context: A281878 A106625 A275902 * A112387 A193174 A126084
Adjacent sequences: A008344 A008345 A008346 * A008348 A008349 A008350


KEYWORD

nonn


AUTHOR

N. J. A. Sloane and J. H. Conway


STATUS

approved



