cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 30 results. Next

A308411 Number of ways to write n as 2^i*3^j + A008347(k), where i, j and k > 0 are nonnegative integers.

Original entry on oeis.org

0, 1, 2, 3, 4, 4, 4, 4, 5, 5, 5, 3, 5, 5, 4, 5, 5, 3, 6, 7, 6, 6, 5, 6, 7, 4, 5, 8, 6, 8, 7, 5, 5, 8, 8, 6, 7, 5, 7, 8, 7, 6, 6, 6, 8, 6, 5, 8, 6, 7, 7, 5, 8, 7, 8, 10, 9, 9, 6, 7, 8, 8, 6, 7, 10, 8, 8, 6, 9, 6, 7, 9, 8, 7, 7, 8, 9, 4, 8, 11, 10, 6, 9, 7, 11, 8, 8, 10, 9, 6, 4, 7, 10, 7, 7, 3, 11, 9, 10, 7
Offset: 1

Views

Author

Zhi-Wei Sun, May 25 2019

Keywords

Comments

Conjecture: a(n) > 0 for all n > 1.
We have verified this for all n = 2..10^6.
Qing-Hu Hou at Tianjin University extended the verification to 2*10^7. Then I used Hou's program to verify a(n) > 0 for n up to 10^9. - Zhi-Wei Sun, May 28 2019
Conjecture verified for n up to 10^10. - Giovanni Resta, May 28 2019

Examples

			a(2) = 1 with 2 = 2^0*3^0 + A008347(2).
a(3) = 2 with 3 = 2^0*3^0 + A008347(1) = 2^1*3^0 + A008347(2).
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=f[n]=FactorInteger[n];
    FQ[n_]:=FQ[n]=n>0&&Part[f[n],Length[f[n]]][[1]]<4;
    s[0]=0; s[n_]:=s[n]=Prime[n]-s[n-1];
    tab={};Do[r=0;Do[If[FQ[n-s[k]],r=r+1],{k,1,2n-1}];tab=Append[tab,r],{n,1,100}];Print[tab]

A308403 Number of ways to write n as 6^i + 3^j + A008347(k), where i, j and k > 0 are nonnegative integers.

Original entry on oeis.org

0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 2, 4, 3, 3, 4, 3, 2, 4, 2, 4, 5, 1, 3, 3, 2, 5, 4, 3, 6, 2, 4, 4, 4, 7, 4, 3, 3, 6, 7, 7, 3, 5, 3, 6, 7, 5, 7, 4, 4, 4, 5, 6, 7, 4, 4, 6, 6, 6, 6, 3, 6, 6, 6, 8, 7, 5, 3, 4, 6, 8, 4, 3, 4, 3, 6, 6, 4, 5, 6, 4, 6, 6, 9, 7, 4, 5, 8, 9, 6, 5, 5, 7, 5, 6, 2, 7, 6, 5
Offset: 1

Views

Author

Zhi-Wei Sun, May 25 2019

Keywords

Comments

Conjecture 1: a(n) > 0 for all n > 2. In other words, each n = 3,4,... can be written as 6^i + 3^j + prime(k) - prime(k-1) + ... + (-1)^(k-1)*prime(1), where i, j and k > 0 are nonnegative integers.
Conjecture 2: If {a,b} is among {2,m} (m = 3..14), {3,4}, {3,5}, then any integer n > 2 can be written as a^i + b^j + A008347(k) with i, j and k > 0 nonnegative integers.
Using Qing-Hu Hou's program, we have verified Conjectures 1 and 2 for n up to 10^9 and 10^7 respectively. - Zhi-Wei Sun, May 28 2019
Conjecture 1 verified up to 10^10. Conjecture 2 holds up to 10^10 for all cases except {2, 12} since 4551086841 cannot be written as 2^i + 12^j + A008347(k). - Giovanni Resta, May 28 2019

Examples

			a(3) = 1 with 3 - (6^0 + 3^0) = 1 = A008347(2).
a(4) = 1 with 4 - (6^0 + 3^0) = 2 = A008347(1).
a(24) = 1 with 24 - (6^0 + 3^0) = 22 = A008347(13).
a(234) = 1 with 234 - (6^1 + 3^3) = 201 = A008347(90).
a(1134) = 1 with 1134 - (6^2 + 3^0) = 1097 = A008347(322).
a(4330) = 1 with 4330 - (6^3 + 3^0) = 4113 = A008347(1016).
a(5619) = 1 with 5619 - (6^1 + 3^3) = 5586 = A008347(1379).
a(6128) = 1 with 6128 - (6^0 + 3^0) = 6126 = A008347(1499).
a(16161) = 1 with 16161 - (6^3 + 3^0) = 15944 = A008347(3445).
a(133544) = 1 with 133544 - (6^0 + 3^8) = 126982 = A008347(22579).
		

Crossrefs

Programs

  • Mathematica
    Pow[n_]:=Pow[n]=n>0&&IntegerQ[Log[3,n]];
    s[0]=0;s[n_]:=s[n]=Prime[n]-s[n-1];
    tab={};Do[r=0;Do[If[s[k]>=n,Goto[bb]];Do[If[Pow[n-s[k]-6^m],r=r+1],{m,0,Log[6,n-s[k]]}];Label[bb],{k,1,2n-1}];tab=Append[tab,r],{n,1,100}];Print[tab]

A131694 Numbers k such that abs(S(k)) = A008347(k) is prime, where S(k) = S(k-1) + A000040(k)*(-1)^k; S(0) = 0.

Original entry on oeis.org

1, 4, 6, 8, 10, 12, 18, 28, 32, 38, 42, 46, 50, 52, 54, 64, 68, 70, 72, 74, 76, 86, 88, 98, 100, 110, 126, 128, 130, 140, 146, 152, 162, 192, 202, 214, 226, 242, 252, 258, 264, 270, 290, 294, 304, 308, 314, 316, 320, 322, 332, 342, 348, 352, 358, 360
Offset: 1

Views

Author

Manuel Valdivia, Oct 03 2007

Keywords

Comments

The sequence include as first term the only case where S(k) = -1 times a prime: S(1) = -2.

Examples

			S(3) = ((0+2*-1)+3*1)+5*-1 = -4, S(4) = -4 + 7*1 = 3 is prime, hence 4 is a term.
S(5) = ((((0+2*-1)+3*1)+5*-1)+7*1)+11*-1 = -8, S(6) = -8 + 13*1 = 5 is prime, hence 6 is a term.
		

Crossrefs

Programs

  • Mathematica
    S=0; Do[S=S+Prime[n]*(-1)^n; If[PrimeQ[S]==True, Print[n]], {n, 1, 10^3, 1}]

A264834 Integers k such that A008347(k) is divisible by k.

Original entry on oeis.org

1, 19, 27, 1293, 41419, 41493, 41519, 41521, 41601, 1629899, 3142492081, 3142492231
Offset: 1

Views

Author

Altug Alkan, Nov 26 2015

Keywords

Comments

Inspired by A008347.
a(n) - a(n-1) = 2 for n = 8.
a(11) > 10^9. - David A. Corneth, Aug 29 2018
a(13) > 7.35*10^12, if it exists. - Giovanni Resta, Sep 05 2018

Examples

			For first 19 prime numbers, (2 - 3 + 5 - 7 + 11 - 13 + 17 - 19 + 23 - 29 + 31 - 37 + 41 - 43 + 47 - 53 + 59 - 61 + 67) mod 19 = 38 mod 19 = 0. So a(2) = 19.
		

Crossrefs

Cf. A008347.

Programs

  • Mathematica
    Select[Range@ 1500, Mod[Abs@ Sum[(-1)^k Prime[# - k], {k, 0, # - 1}], #] == 0 &] (* Michael De Vlieger, Nov 27 2015, after Robert G. Wilson v at A008347 *)
  • PARI
    for(n=1, 1e5, if(sum(k=0, n-1, (-1)^(k)*prime(n-k)) % n == 0, print1(n,", ")))
    
  • PARI
    upto(n) = my(s = t = 0, u=prime(n), res=List()); forprime(p=2, u, t++; s = (p - s); if(s % t == 0, listput(res, i))); res \\ David A. Corneth, Aug 29 2018

Formula

a(n) mod 2 = 1.

Extensions

a(10) from David A. Corneth, Aug 29 2018
a(11)-a(12) from Giovanni Resta, Sep 03 2018

A001223 Prime gaps: differences between consecutive primes.

Original entry on oeis.org

1, 2, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2, 4, 2, 4, 14, 4, 6, 2, 10, 2, 6, 6, 4, 6, 6, 2, 10, 2, 4, 2, 12, 12, 4, 2, 4, 6, 2, 10, 6, 6, 6, 2, 6, 4, 2, 10, 14, 4, 2, 4, 14, 6, 10, 2, 4, 6, 8, 6, 6, 4, 6, 8, 4, 8, 10, 2, 10, 2, 6, 4, 6, 8, 4, 2, 4, 12, 8, 4, 8, 4, 6, 12
Offset: 1

Views

Author

Keywords

Comments

There is a unique decomposition of the primes: provided the weight A117078(n) is > 0, we have prime(n) = weight * level + gap, or A000040(n) = A117078(n) * A117563(n) + a(n). - Rémi Eismann, Feb 14 2008
Let rho(m) = A179196(m), for any n, let m be an integer such that p_(rho(m)) <= p_n and p_(n+1) <= p_(rho(m+1)), then rho(m) <= n < n + 1 <= rho(m + 1), therefore a(n) = p_(n+1) - p_n <= p_rho(m+1) - p_rho(m) = A182873(m). For all rho(m) = A179196(m), a(rho(m)) < A165959(m). - John W. Nicholson, Dec 14 2011
A solution (modular square root) of x^2 == A001248(n) (mod A000040(n+1)). - L. Edson Jeffery, Oct 01 2014
There exists a constant C such that for n -> infinity, Cramer conjecture a(n) < C log^2 prime(n) is equivalent to (log prime(n+1)/log prime(n))^n < e^C. - Thomas Ordowski, Oct 11 2014
a(n) = A008347(n+1) - A008347(n-1). - Reinhard Zumkeller, Feb 09 2015
Yitang Zhang proved lim inf_{n -> infinity} a(n) is finite. - Robert Israel, Feb 12 2015
lim sup_{n -> infinity} a(n)/log^2 prime(n) = C <==> lim sup_{n -> infinity}(log prime(n+1)/log prime(n))^n = e^C. - Thomas Ordowski, Mar 09 2015
a(A038664(n)) = 2*n and a(m) != 2*n for m < A038664(n). - Reinhard Zumkeller, Aug 23 2015
If j and k are positive integers then there are no two consecutive primes gaps of the form 2+6j and 2+6k (A016933) or 4+6j and 4+6k (A016957). - Andres Cicuttin, Jul 14 2016
Conjecture: For any positive numbers x and y, there is an index k such that x/y = a(k)/a(k+1). - Andres Cicuttin, Sep 23 2018
Conjecture: For any three positive numbers x, y and j, there is an index k such that x/y = a(k)/a(k+j). - Andres Cicuttin, Sep 29 2018
Conjecture: For any three positive numbers x, y and j, there are infinitely many indices k such that x/y = a(k)/a(k+j). - Andres Cicuttin, Sep 29 2018
Row m of A174349 lists all indices n for which a(n) = 2m. - M. F. Hasler, Oct 26 2018
Since (6a, 6b) is an admissible pattern of gaps for any integers a, b > 0 (and also if other multiples of 6 are inserted in between), the above conjecture follows from the prime k-tuple conjecture which states that any admissible pattern occurs infinitely often (see, e.g., the Caldwell link). This also means that any subsequence a(n .. n+m) with n > 2 (as to exclude the untypical primes 2 and 3) should occur infinitely many times at other starting points n'. - M. F. Hasler, Oct 26 2018
Conjecture: Defining b(n,j,k) as the number of pairs of prime gaps {a(i),a(i+j)} such that i < n, j > 0, and a(i)/a(i+j) = k with k > 0, then
lim_{n -> oo} b(n,j,k)/b(n,j,1/k) = 1, for any j > 0 and k > 0, and
lim_{n -> oo} b(n,j,k1)/b(n,j,k2) = C with C = C(j,k1,k2) > 0. - Andres Cicuttin, Sep 01 2019

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 870.
  • GCHQ, The GCHQ Puzzle Book, Penguin, 2016. See page 92.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See pp. 186-192.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000040 (primes), A001248 (primes squared), A000720, A037201, A007921, A030173, A036263-A036274, A167770, A008347.
Second difference is A036263, first occurrence is A000230.
For records see A005250, A005669.
Sequences related to the differences between successive primes: A001223 (Delta(p)), A028334, A080378, A104120, A330556-A330561.

Programs

  • Haskell
    a001223 n = a001223_list !! (n-1)
    a001223_list = zipWith (-) (tail a000040_list) a000040_list
    -- Reinhard Zumkeller, Oct 29 2011
    
  • Magma
    [(NthPrime(n+1) - NthPrime(n)): n in [1..100]]; // Vincenzo Librandi, Apr 02 2011
    
  • Maple
    with(numtheory): for n from 1 to 500 do printf(`%d,`,ithprime(n+1) - ithprime(n)) od:
  • Mathematica
    Differences[Prime[Range[100]]] (* Harvey P. Dale, May 15 2011 *)
  • PARI
    diff(v)=vector(#v-1,i,v[i+1]-v[i]);
    diff(primes(100)) \\ Charles R Greathouse IV, Feb 11 2011
    
  • PARI
    forprime(p=1, 1e3, print1(nextprime(p+1)-p, ", ")) \\ Felix Fröhlich, Sep 06 2014
    
  • Python
    from sympy import prime
    def A001223(n): return prime(n+1)-prime(n) # Chai Wah Wu, Jul 07 2022
  • Sage
    differences(prime_range(1000)) # Joerg Arndt, May 15 2011
    

Formula

G.f.: b(x)*(1-x), where b(x) is the g.f. for the primes. - Franklin T. Adams-Watters, Jun 15 2006
a(n) = prime(n+1) - prime(n). - Franklin T. Adams-Watters, Mar 31 2010
Conjectures: (i) a(n) = ceiling(prime(n)*log(prime(n+1)/prime(n))). (ii) a(n) = floor(prime(n+1)*log(prime(n+1)/prime(n))). (iii) a(n) = floor((prime(n)+prime(n+1))*log(prime(n+1)/prime(n))/2). - Thomas Ordowski, Mar 21 2013
A167770(n) == a(n)^2 (mod A000040(n+1)). - L. Edson Jeffery, Oct 01 2014
a(n) = Sum_{k=1..2^(n+1)-1} (floor(cos^2(Pi*(n+1)^(1/(n+1))/(1+primepi(k))^(1/(n+1))))). - Anthony Browne, May 11 2016
G.f.: (Sum_{k>=1} x^pi(k)) - 1, where pi(k) is the prime counting function. - Benedict W. J. Irwin, Jun 13 2016
Conjecture: Limit_{N->oo} (Sum_{n=2..N} log(a(n))) / (Sum_{n=2..N} log(log(prime(n)))) = 1. - Alain Rocchelli, Dec 16 2022
Conjecture: The asymptotic limit of the average of log(a(n)) ~ log(log(prime(n))) - gamma (where gamma is Euler's constant). Also, for n tending to infinity, the geometric mean of a(n) is equivalent to log(prime(n)) / e^gamma. - Alain Rocchelli, Jan 23 2023
It has been conjectured that primes are distributed around their average spacing in a Poisson distribution (cf. D. A. Goldston in above links). This is the basis of the last two conjectures above. - Alain Rocchelli, Feb 10 2023

Extensions

More terms from James Sellers, Feb 19 2001

A036467 a(n) + a(n-1) = n-th prime.

Original entry on oeis.org

1, 1, 2, 3, 4, 7, 6, 11, 8, 15, 14, 17, 20, 21, 22, 25, 28, 31, 30, 37, 34, 39, 40, 43, 46, 51, 50, 53, 54, 55, 58, 69, 62, 75, 64, 85, 66, 91, 72, 95, 78, 101, 80, 111, 82, 115, 84, 127, 96, 131, 98, 135, 104, 137, 114, 143, 120, 149, 122, 155, 126, 157, 136, 171, 140, 173
Offset: 0

Views

Author

Keywords

Comments

After the initial 1,1, this sequence contains no duplicate values: terms thereafter have opposite parity, and a(n+2) > a(n). Do even and odd values trade the lead infinitely often? (We would expect them to if we model their difference as a random walk.) - Franklin T. Adams-Watters, Jan 25 2010

Crossrefs

Programs

  • Haskell
    a036467 n = a036467_list !! n
    a036467_list = 1 : zipWith (-) a000040_list a036467_list
    -- Reinhard Zumkeller, Nov 02 2011
  • Magma
    [n lt 2 select 1 else NthPrime(n)-NthPrime(n-1)+Self(n-1): n in [0..65]];  // Bruno Berselli, Jun 18 2011
    
  • Mathematica
    a[n_] := Abs[1+Sum[(-1)^(k+1)*Prime[k], {k, 2, n}]]; a /@ Range[0, 65] (* Jean-François Alcover, Apr 22 2011 *)
    t={1,1};Do[AppendTo[t,NextPrime[t[[-2]]+t[[-1]]]-t[[-1]]],{n,64}];t (* Vladimir Joseph Stephan Orlovsky, Jan 26 2012 *)
    Transpose[NestList[{First[#]+1,Prime[First[#]+1]-Last[#]}&,{0,1},70]][[2]] (* Harvey P. Dale, Sep 14 2012 *)
  • PARI
    print1(t=1);forprime(p=2,1e3,print1(", ",t=p-t)) \\ Charles R Greathouse IV, Jun 18 2011
    

Extensions

More terms from Jud McCranie

A222532 a(1)=2; for n >= 1, a(n+1) is the least prime p_m such that a(n)=p_m-p_{m-1}+...+(-1)^{m-k}p_k for some 0

Original entry on oeis.org

2, 5, 7, 13, 17, 23, 31, 37, 43, 53, 59, 67, 73, 83, 89, 101, 109, 113, 131, 149, 157, 163, 173, 179, 197, 223, 257, 263, 269, 277, 283, 311, 347, 389, 401, 421, 431, 487, 503, 523, 557, 569, 577, 601, 613, 641, 661, 709, 733, 739, 773, 823, 827, 857, 883, 929, 947, 953, 977, 983, 997, 1009, 1019, 1031, 1039, 1051, 1097, 1117, 1129, 1151, 1181, 1223, 1229, 1237, 1249, 1279, 1327, 1361, 1373, 1423, 1459, 1481, 1499, 1543, 1559, 1571, 1601, 1621, 1627, 1669, 1693, 1699, 1721, 1733, 1759, 1783, 1823, 1873, 1973, 2011
Offset: 1

Views

Author

Zhi-Wei Sun, Feb 24 2013

Keywords

Comments

Conjecture: For any given prime p, if we define b(1)=p and let b(n+1) be the least prime p_m such that b(n)=p_m-p_{m-1}+...+(-1)^{m-k}p_k for some 0p adjacent if and only if q is the least prime p_m such that p=p_m-p_{m-1}+...+(-1)^{m-k}p_k for some 0
Clearly the graph T contains no cycle. The vertices on the unique path connecting 2 and 71 are listed (in order) below: 2, 5, 7, 13, 17, 23, 31, 37, 43, 53, 59, 67, 73, 83, 89, 101, 109, 113, 131, 149, 139, 107, 97, 79, 71.

Examples

			a(2)=5 and a(3)=7 since 2=5-3 and 5=7-5+3.
		

Crossrefs

Programs

  • Mathematica
    k=1
    n=1
    s[0_]:=0
    s[n_]:=s[n]=Prime[n]-s[n-1]
    Do[If[m==1,Print[n," ",2]];If[m==k,n=n+1;Do[If[s[j]-(-1)^(j-i)*s[i]==Prime[m],k=j;Print[n," ",Prime[j]];Goto[aa]],{j,m+1,PrimePi[3Prime[m]]},{i,0,j-2}]];
    Label[aa];Continue,{m,1,1000}]

A330545 a(1) = 2; thereafter a(n) = a(n-1) + (-1)^(n + 1)*(prime(n) - prime(n - 1) - 1) (where prime(k) denotes the k-th prime).

Original entry on oeis.org

2, 2, 3, 2, 5, 4, 7, 6, 9, 4, 5, 0, 3, 2, 5, 0, 5, 4, 9, 6, 7, 2, 5, 0, 7, 4, 5, 2, 3, 0, 13, 10, 15, 14, 23, 22, 27, 22, 25, 20, 25, 24, 33, 32, 35, 34, 45, 34, 37, 36, 39, 34, 35, 26, 31, 26, 31, 30, 35, 32, 33, 24, 37, 34, 35, 32, 45, 40, 49, 48, 51, 46, 53, 48, 53, 50, 55, 48, 51, 44, 53
Offset: 1

Author

N. J. A. Sloane, Dec 17 2019

Keywords

Comments

a(n) is the column of the Boustrophedon triangle in A330339 that contains prime(n).
If a(n) = 0 then p = prime(n) is a term of A330339, and n is a term of A330546.
Since this has a simple recurrence, it is the key to understanding A330339. However, note that this sequence in turn can be simply expressed in terms of the classic sequence A008347:
a(n) = prime(n) + 1 - 2 * A008347(n) if n is even,
a(n) = 2 * A008347(n) - prime(n) if n is odd.
The sequence that ties all these sequences together is A330547 (q.v.).
First negative term is a(146) = -2.
Note on the links: The illustrations from Angelini and Trump show all the terms 0,1,2,3,4,... (as in A330339), while those of Havermann, Sloane, and Stevenson just show the primes.
The column number mod 4 uniquely determines the residue class of primes mod 4 in that column. If the column number is 0,1,2,3 mod 4 then the primes in that column are 1,3,3,1 respectively (see the "Notes" link). - N. J. A. Sloane, Jan 04 2020
For large n, the graphs of A330545 and A330547 are essentially identical.
Based on the first 10^12 terms, it appears that lim sup |a(n)| is about n^(2/3). This estimate is based on the plots below by Sloane, Trump (the first plot), Havermann (the first plot), and Stevenson (all three plots). - N. J. A. Sloane, Jan 21 2020

Programs

Formula

G.f.: G(-x)*(x+1)/(x-1), where G(x) = 2*x + 2*x^2 +3*x^3 + 4*x^4 + 7*x^5 + ... is the g.f. for A014692, {prime(n) - (n-1): n >= 1}.

Extensions

Keyword nonn changed to sign by Hans Havermann, Dec 27 2019

A330547 a(1)=2; thereafter a(n) = a(n-1) + (-1)^(n+1)*(prime(n)-prime(n-1)) (where prime(k) denotes the k-th prime).

Original entry on oeis.org

2, 1, 3, 1, 5, 3, 7, 5, 9, 3, 5, -1, 3, 1, 5, -1, 5, 3, 9, 5, 7, 1, 5, -1, 7, 3, 5, 1, 3, -1, 13, 9, 15, 13, 23, 21, 27, 21, 25, 19, 25, 23, 33, 31, 35, 33, 45, 33, 37, 35, 39, 33, 35, 25, 31, 25, 31, 29, 35, 31, 33, 23, 37, 33, 35, 31, 45, 39, 49, 47, 51, 45, 53, 47, 53, 49, 55, 47, 51, 43, 53, 51, 61, 59, 65, 61
Offset: 1

Author

N. J. A. Sloane, Dec 19 2019

Keywords

Comments

There are several equivalent definitions:
a(n) = (-1)^(n+1)*(prime(n) + 2*(Sum_{i=1..n-1} (-1)^i*prime(n-i)));
a(n) = (-1)^n*(prime(n) - 2*A008347(n)) for n >= 1;
a(n) = A330545(n) if n is odd, a(n) = A330545(n)-1 if n is even;
generating function = P(-x)*(x+1)/(x-1), where P(x) = 2*x + 3*x^2 + 5*x^3 + ... = Sum_{k>=1} prime(k)*x^k is the g.f. for the primes.
Note that the recurrence closely resembles that of A330545, but is slightly simpler. Hans Havermann's graphs of A330545, linked here, also essentially apply to the present sequence.
This sequence ties together A330339, A330545, A008347, and the primes.
Just as A330545 describes the boustrophedon path that generates the "Boustrophedon Primes" in A330339, the present sequence can also be regarded as defining a boustrophedon path with a slightly different rule, as follows. Write the numbers 0, 1, 2, 3, ... in a triangle on a square grid in the boustrophedon manner, ending a row when a prime is reached, and starting the next row in the opposite direction, but displaced by one square in that direction:
-1.0.1.2.3..4..5..6..7..8..9.
-----------------------------
...0 1 2
.....3
.......4 5
.....7 6
.......8 9 10 11
........13 12
...........14 15 16 17
..............19 18
.................20 21 22 23
...
Since all primes>2 are odd, here the odd primes only appear in odd-number4d columns (and in particular there are no primes in column 0).
In fact the primes (other than 2) occur only in odd-numbered columns: primes congruent to 3 mod 4 occur in columns congruent to 1 mod 4, and primes congruent to 1 mod 4 occur in columns congruent to 3 mod 4. See the "Notes" link for proof. - N. J. A. Sloane, Jan 04 2020
It would be nice to know something about the asymptotic growth of this sequence. The usual estimates for the primes do not seem to produce anything useful.
For large n, the graphs of A330545 and A330547 are essentially identical.
Based on the first 10^12 terms, it appears that lim sup |a(n)| is about n^(2/3). This estimate is based on the plots given in A330545 by Sloane, Trump (the first plot), Havermann (the first plot), and Stevenson (all three plots).- N. J. A. Sloane, Jan 21 2020
Conjecture. Let k be an integer and X_k be the set of all n such that (-1)^n*a(n)=2k-1. If a, b are integers and a<>0, then X_k contains infinitely many terms of the arithmetic progression {a*n+b: n integer}. - M. Farrokhi D. G., Nov 12 2023

Crossrefs

Programs

  • Maple
    f:=n-> (-1)^(n+1)*(ithprime(n)+2*add((-1)^i*ithprime(n-i),i=1..n-1));
    [seq(f(n),n=1..400)];
  • Mathematica
    a[1]=2; a[n_]:= a[a]=a[n-1]+ (-1)^(n+1)*(Prime[n]-Prime[n-1]);Table[a[n],{n,86}] (* James C. McMahon, Dec 18 2023 *)

A066033 Alternating sum of primes: a(1) = A000040(1) = 2 and a(n) = a(n-1) + A000040(n)*(-1)^n for n > 1.

Original entry on oeis.org

2, 5, 0, 7, -4, 9, -8, 11, -12, 17, -14, 23, -18, 25, -22, 31, -28, 33, -34, 37, -36, 43, -40, 49, -48, 53, -50, 57, -52, 61, -66, 65, -72, 67, -82, 69, -88, 75, -92, 81, -98, 83, -108, 85, -112, 87, -124, 99, -128, 101, -132, 107, -134, 117, -140, 123, -146, 125, -152, 129, -154, 139, -168, 143, -170, 147, -184, 153
Offset: 1

Author

Reinhard Zumkeller, Dec 12 2001

Keywords

Crossrefs

Programs

  • Maple
    ListTools:-PartialSums([2,seq((-1)^n*ithprime(n),n=2..100)]); # Robert Israel, Jun 14 2016
  • Mathematica
    4 + Accumulate[Table[Prime[n](-1)^(n), {n, 1, 70}]] (* Terry D. Grant, Jun 14 2016 *)
  • PARI
    { for (n=1, 1000, if (n==1, a=2, a+=prime(n)*(-1)^n); write("b066033.txt", n, " ", a) ) } \\ Harry J. Smith, Nov 07 2009

Formula

a(n) = 4 + (-1)^n*A008347(n). - Robert Israel, Jun 14 2016
Showing 1-10 of 30 results. Next