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.

A135311 A greedy sequence of prime offsets.

Original entry on oeis.org

0, 2, 6, 8, 12, 18, 20, 26, 30, 32, 36, 42, 48, 50, 56, 62, 68, 72, 78, 86, 90, 96, 98, 102, 110, 116, 120, 128, 132, 138, 140, 146, 152, 156, 158, 162, 168, 176, 182, 186, 188, 198, 200, 210, 212, 216, 230, 240, 242, 246, 252, 260, 266, 270, 272, 278, 282
Offset: 1

Views

Author

galathaea(AT)gmail.com, Dec 07 2007

Keywords

Comments

Given a(i) for 1 <= i < n, a(n) is the smallest number > a(n-1) such that, for every prime p, the set {a(i) mod p : 1<=i<=n} has at most p-1 elements. Assuming Schinzel's hypothesis H, an equivalent statement is that a(n) is minimal such that there are infinitely many primes p with p+a(i) prime for 1 <= i <= n.
For every n, a(n) is not congruent to 1 (mod 2), nor to 1 (mod 3), nor to 4 (mod 5), nor to 3 (mod 7), ...
Note that this sequence does not always give the minimal difference between the first and last of n consecutive large primes, A008407. E.g., a(6)=18 but the 6 consecutive primes 97, 101, 103, 107, 109, 113 give the minimal difference of 16.

Examples

			Given a(1) through a(5), a(6) can't be 14 since the set {0,2,6,8,12,14} contains elements from every residue class (mod 5). a(6) can't be 16 because {0,2,6,8,12,16} contains elements from every residue class (mod 3). a(6)=18 is possible, since the residues (mod 2) are all 0, the residues (mod 3) are all 0 or 2 and the residues (mod 5) are all 0, 1, 2, or 3.
		

Crossrefs

Programs

  • Mathematica
    a[1]=0;a[n_]:=a[n]=Module[{v,set,ok,p},For[v=a[n-1]+2,True,v+=2,set=Append[a/@Range[n-1],v]; For[p=3;ok=True,p<=n,p+=2,If[PrimeQ[p]&&Length[Union[Mod[set,p]]]==p,ok=False;Break[]]];If[ok,Return[v]]]]
  • PARI
    {greedy()=local(A, L, B, n, v , ok , R, setR, p, k);
    A=vector(2089); \\ 2089 is the length to get Sum_{i>=2}(1/A[i])>2; see Ford, Luca, Moree paper, p. 1454
    L=length(A); B = 10^(5); \\ upper bound for the number of primes used; enough for the first 2089 terms
    A[1]=0;  \\ first trivial term;
    for (n=2, L,
    R=vector(n);
    forstep (v=A[n-1]+2, B, 2 , ok=1;
    forprime(p = 2, v,
    for(k=1,n-1, R[k]=A[k]%p);
    R[n]=v%p;
    setR=Set(R);
    if (length(setR) > p-1, ok=0; break);  \\ v is not good
    );
    if (ok==1, A[n]=v; break);
    );
    );
    return(A)
    } \\ Alessandro Languasco, Aug 11 2019

Extensions

Edited by Dean Hickerson, Dec 07 2007