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-4 of 4 results.

A078584 a(n) = prime(2n) - prime(2n-1).

Original entry on oeis.org

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

Views

Author

Robert G. Wilson v, Nov 30 2002

Keywords

Comments

First differences of A077133. Bisection of A001223.
Partition the primes in pairs starting with 5: (5, 7), (11, 13), (17, 19), (23, 29), (31, 37), (41, 43), (47, 53). Sequence gives differences between pairs. - Zak Seidov, Oct 05 2003

Examples

			a(4)=6 as a_o(5)=58 - a_e(5)=71 is 13 and a_o(4)=35 - a_e(4)=42 is 7 and the difference is 6.
		

Crossrefs

Programs

  • Mathematica
    Table[ Prime[2n] - Prime[2n - 1], {n, 100}] (* Robert G. Wilson v, May 29 2004 *)

Extensions

Edited by N. J. A. Sloane, Sep 15 2008 at the suggestion of R. J. Mathar

A106738 Difference between the sums of odd-indexed primes and even-indexed primes up to and including index 10^n.

Original entry on oeis.org

13, 251, 4031, 52017, 652039, 7746369, 89721621, 1019145113, 11401770915, 126048548239
Offset: 1

Views

Author

Cino Hilliard, May 15 2005

Keywords

Crossrefs

Programs

  • Maple
    A106738 := proc(n) local a,i ; a :=0 ; for i from 1 to 10^n do a := a+(-1)^i*ithprime(i) ; od: RETURN(a) ; end: for n from 1 do print(A106738(n)) ; od: # R. J. Mathar, Feb 13 2008
  • Mathematica
    a[n_] := Module[{a = 0}, For[i = 1, i <= 10^n, i++, a = a + (-1)^i*Prime[i]]; a]; Table[Print[an = a[n]]; an, {n, 1, 8}] (* Jean-François Alcover, Dec 17 2012, after R. J. Mathar *)
  • PARI
    lista(pmax) = {my(pow = 10, k = 0, s = 0); forprime(p = 1, pmax, k++; s += ((-1)^k * p); if(k == pow, print1(s, ", "); pow *= 10));} \\ Amiram Eldar, Jul 02 2024

Formula

a(n) = Sum2 - Sum1, where Sum1 = prime(1) + prime(3) + ... + prime(10^n-1), and Sum2 = prime(2) + prime(4) + ... + prime(10^n).
a(n) = Sum_{i=1..10^n} (-1)^i*A000040(i). - R. J. Mathar, Feb 13 2008
a(n) = A077133(10^n/2). - Amiram Eldar, Jul 02 2024

Extensions

Edited by R. J. Mathar, Feb 13 2008
a(7)-a(8) from Donovan Johnson, Nov 30 2008
a(9)-a(10) from Amiram Eldar, Jul 02 2024

A228669 Numbers k for which sum{prime(2*k) - prime(2*k-1)} is prime.

Original entry on oeis.org

2, 3, 4, 5, 6, 9, 14, 16, 19, 21, 23, 25, 26, 27, 32, 34, 35, 36, 37, 38, 43, 44, 49, 50, 55, 63, 64, 65, 70, 73, 76, 81, 96, 101, 107, 113, 121, 126, 129, 132, 135, 145, 147, 152, 154, 157, 158, 160, 161, 166, 171, 174, 176, 179, 180, 183, 187, 196, 197
Offset: 1

Views

Author

Clark Kimberling, Oct 01 2013

Keywords

Examples

			a(6) = 9 because 3-2 + 7-5 + 13-11 + 19-17 + 29-23 + 37-31 = 19 =
A077133(6) is a prime.
		

Crossrefs

Cf. A077133.

Programs

  • Mathematica
    z = 300; f[n_] := Sum[Prime[2 k] - Prime[2 k - 1], {k, 1, n}]
    Table[f[n], {n, 1, z}]  (* A077133 *)
    g[n_] := If[PrimeQ[f[n]], 1, 0]; t = Table[g[n], {n, 1, z}]; Flatten[Position[t, 1]]
    Position[Accumulate[#[[2]]-#[[1]]&/@Partition[Prime[Range[400]],2]], ?PrimeQ]//Flatten (* _Harvey P. Dale, Jul 26 2018 *)

A318789 For n >= 3, a(n) is equal to n-1 plus the alternating sum of all consecutive prime gaps between odd primes <= n.

Original entry on oeis.org

2, 3, 2, 3, 6, 7, 8, 9, 6, 7, 10, 11, 12, 13, 10, 11, 14, 15, 16, 17, 14, 15, 16, 17, 18, 19, 26, 27, 26, 27, 28, 29, 30, 31, 38, 39, 40, 41, 38, 39, 42, 43, 44, 45, 42, 43, 44, 45, 46, 47, 54, 55, 56, 57, 58, 59, 54, 55, 58, 59, 60, 61, 62, 63, 58, 59, 60, 61, 66, 67, 66, 67, 68
Offset: 3

Views

Author

Christopher Hohl, Dec 15 2018

Keywords

Comments

Beginning at prime(2)=3, group all primes into even/odd-indexed pairs, (prime(2n), prime(2n+1)). Then a(prime(2n)) and a(prime(2n+1)) are both equal to 2*A077133(n).
This sequence consists of runs of an even number of consecutive numbers. - David A. Corneth, Dec 18 2018

Examples

			a(12)=7 because the alternating sum of all consecutive prime gaps for all odd primes less than/equal to 12 is -2+2-4, and 11+(-2+2-4)=7.
a(13)=10 because the alternating sum of all consecutive prime gaps for all odd primes less than/equal to 13 is -2+2-4+2=-2, and 12+(-2+2-4+2)=10.
		

Programs

  • PARI
    first(n) = my(res = vector(n), p = 3, sgn = 1, primegap = 0); res[1] = 2; for(i = 2, n, res[i] = res[i-1]+1; if(isprime(i+2), sgn=-sgn; primegap = i+2-p; res[i]+=sgn*primegap; p = i+2)); res \\ David A. Corneth, Dec 18 2018

Formula

a(3) = 2. a(n + 1) = a(n) + 1 for composite n + 1. For prime n + 1, a(n + 1) = a(n) + 1 - (n + 1 - p) where p is the largest prime < (n + 1). - David A. Corneth, Dec 18 2018
Showing 1-4 of 4 results.