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

A022885 Primes p=prime(k) such that prime(k) + prime(k+3) = prime(k+1) + prime(k+2).

Original entry on oeis.org

5, 7, 11, 13, 23, 37, 53, 73, 97, 101, 103, 109, 137, 157, 179, 191, 223, 251, 263, 307, 353, 373, 389, 409, 419, 433, 457, 479, 487, 541, 563, 571, 593, 683, 691, 701, 757, 809, 821, 853, 859, 877, 883, 911, 977, 1019, 1039, 1049, 1087, 1103
Offset: 1

Views

Author

Keywords

Comments

These are primes p for which the subsequent alternate prime gaps are equal, so (p(k+3)-p(k+2))/(p(k+1)-p(k)) = 1. It is conjectured that the most frequent alternate prime gaps ratio is one. - Andres Cicuttin, Nov 07 2016

Examples

			Starting from 5, the four consecutive primes are 5, 7, 11, 13; and they satisfy 5 + 13 = 7 + 11. So 5 is in the sequence.
		

Crossrefs

Programs

  • Magma
    [NthPrime(n): n in [1..200] | (NthPrime(n)+NthPrime(n+3)) eq (NthPrime(n+1)+NthPrime(n+2))]; // Vincenzo Librandi, Nov 08 2016
    
  • Mathematica
    Transpose[Select[Partition[Prime[Range[500]],4,1],First[#]+Last[#] == #[[2]]+#[[3]]&]][[1]] (* Harvey P. Dale, May 23 2011 *)
  • PARI
    isok(p) = {my(k = primepi(p)); (p == prime(k)) && ((prime(k) + prime(k+3)) == (prime(k+1) + prime(k+2)));} \\ Michel Marcus, Jan 15 2014
    
  • Python
    from sympy import nextprime
    from itertools import islice
    def agen(): # generator of terms
        p, q, r, s = [2, 3, 5, 7]
        while True:
            if p + s == q + r: yield p
            p, q, r, s = q, r, s, nextprime(s)
    print(list(islice(agen(), 50))) # Michael S. Branicky, May 31 2024

Formula

a(n) = A000040(A022884(n)). - Amiram Eldar, May 06 2020

Extensions

Name edited by Michel Marcus, Jan 15 2014

A261470 a(n) = prime(n+3) - prime(n+2) - prime(n+1) + prime(n).

Original entry on oeis.org

1, 2, 0, 0, 0, 0, 4, -2, 0, 2, -4, 0, 4, 2, -4, 0, 2, -4, 2, 2, 0, 4, -2, -6, 0, 0, 0, 12, 0, -8, -2, 4, 0, -4, 4, -2, 0, 2, -4, 4, 0, -6, 0, 8, 10, -8, -10, 0, 4, -2, 4, 4, -4, 0, -4, 0, 2, -4, 6, 12, -6, -12, 0, 12, 2, -4, -4, -6, 4, 4, 0, -2, -2, 0, 4, -2, 0
Offset: 1

Views

Author

Altug Alkan, Aug 20 2015

Keywords

Examples

			a(5) = 19 - 17 - 13 + 11 = 0.
		

Crossrefs

Programs

  • Haskell
    a261470 n = a261470_list !! (n-1)
    a261470_list = zipWith (-) (drop 2 a001223_list) a001223_list
    -- Reinhard Zumkeller, Aug 22 2015
  • Mathematica
    Table[Prime[i+3] - Prime[i+2] - Prime[i+1] + Prime[i], {i,100}] (* G. C. Greubel, Aug 20 2015 *)
  • PARI
    first(m)=vector(m,i,prime(i+3)+prime(i)-prime(i+1)-prime(i+2)) \\ Anders Hellström, Aug 20 2015
    

Formula

a(n) = A001223(n+2) - A001223(n). - Reinhard Zumkeller, Aug 22 2015

A351124 a(n) is the least k > 0 such that the set { prime(n), ..., prime(n+k-1) } can be partitioned into two disjoint sets with equal sum, or -1 if no such k exists (prime(n) denotes the n-th prime number).

Original entry on oeis.org

3, 6, 4, 4, 4, 4, 8, 10, 4, 8, 8, 4, 10, 14, 6, 4, 6, 6, 8, 8, 4, 8, 12, 10, 4, 4, 4, 8, 4, 8, 6, 10, 4, 6, 8, 18, 4, 6, 8, 6, 4, 12, 4, 8, 10, 6, 10, 4, 8, 6, 8, 12, 10, 4, 6, 4, 8, 8, 10, 8, 12, 8, 4, 12, 6, 6, 8, 8, 14, 8, 4, 8, 10, 4, 10, 6, 4, 10, 8, 4, 4
Offset: 1

Views

Author

Rémy Sigrist, Feb 02 2022

Keywords

Comments

Conjecture: all terms are positive.

Examples

			The first terms, alongside an appropriate partition {P, Q}, are:
  n   a(n)  P                     Q
  --  ----  --------------------  --------------------
   1     3  {2, 3}                {5}
   2     6  {3, 5, 7, 13}         {11, 17}
   3     4  {5, 13}               {7, 11}
   4     4  {7, 17}               {11, 13}
   5     4  {11, 19}              {13, 17}
   6     4  {13, 23}              {17, 19}
   7     8  {17, 29, 31, 43}      {19, 23, 37, 41}
   8    10  {19, 31, 41, 47, 53}  {23, 29, 37, 43, 59}
   9     4  {23, 37}              {29, 31}
  10     8  {29, 41, 47, 53}      {31, 37, 43, 59}
		

Crossrefs

Cf. A022884.

Programs

  • PARI
    a(n) = { my (s=[0], k=0); forprime (p=prime(n), oo, s=setunion(apply (v -> v-p, s), apply (v -> v+p, s)); k++; if (setsearch(s, 0), return (k))) }

Formula

a(n) = 4 iff n belongs to A022884.
Showing 1-3 of 3 results.