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.

A126938 a(1) = 3, a(n) = the smallest prime p > a(n-1) such that (a(n-1)+p)/2 is prime.

Original entry on oeis.org

3, 7, 19, 43, 79, 127, 151, 163, 199, 223, 331, 367, 379, 439, 487, 607, 619, 643, 739, 883, 991, 1051, 1087, 1171, 1231, 1327, 1471, 1627, 1699, 1747, 1759, 1987, 1999, 2179, 2383, 2551, 2683, 2731, 2767, 3067, 3259, 3343, 3571, 3643, 3739, 3847, 3907
Offset: 1

Views

Author

Zak Seidov, Mar 18 2007

Keywords

Comments

Starting with a(2)=7 all terms are 7 mod 12. - Zak Seidov, Feb 26 2017

Examples

			(3+7)/2=5 prime, (7+19)/2=13 prime, (19+43)/2=31 prime, etc.
		

Crossrefs

Programs

  • Maple
    A[1]:= 3: A[2]:= 7:
    for n from 3 to 100 do A[n]:= f(A[n-1]) od:
    seq(A[i],i=1..100); # Robert Israel, Feb 27 2017
  • Mathematica
    s={3};pn=3;n=PrimePi[pn];Do[Do[p=Prime[i];If[PrimeQ[(pn+p)/2],AppendTo[s,p];pn=p;n=i;Break[]],{i,n+1,10000}],{112}];s
    sp[n_]:=Module[{p=NextPrime[n]},While[!PrimeQ[(n+p)/2],p=NextPrime[p]];p]; NestList[sp,3,50] (* Harvey P. Dale, Apr 12 2013 *)
  • PARI
    step(q)=forprime(p=q+1,, if(isprime((p+q)/2), return(p)))
    first(n)=my(v=vector(n)); v[1]=3; for(k=2,n, v[k]=step(v[k-1])); v \\ Charles R Greathouse IV, Feb 27 2017