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.

A213187 a(n) = (p+1)/2 if 4 | p+1, and p otherwise, where p is the least prime > n with 2(n+1)-p prime.

Original entry on oeis.org

2, 2, 5, 5, 4, 4, 6, 6, 13, 6, 13, 13, 17, 17, 10, 17, 10, 10, 12, 12, 16, 12, 29, 16, 29, 16, 37, 29, 16, 16, 41, 37, 37, 41, 41, 37, 24, 41, 22, 41, 22, 22, 24, 24, 61, 24, 53, 61, 53, 30, 61, 53, 61, 34, 30, 61, 73, 30, 61, 61, 36, 34, 34, 36, 36, 34, 42, 36, 73, 36, 73, 73, 89, 40, 40, 42, 42, 40, 89, 42, 97, 42, 89, 97, 89, 101, 97, 89, 97, 52, 101, 97, 109, 101, 52, 97, 54, 101, 52, 101
Offset: 1

Views

Author

Zhi-Wei Sun, Feb 28 2013

Keywords

Comments

Conjecture: If b(1)>2 is an integer, and b(k+1)=a(b(k)) for k=1,2,3,..., then b(n)=4 for some n>0.
For example, if we start from b(1)=45 then we get the sequence 45, 61, 36, 37, 24, 16, 17, 10, 6, 4, 5, 4, ...

Examples

			a(8)=6 since 2(8+1)=11+5 with (11+1)/2=6;
a(9)=13 since 2(9+1)=13+7.
		

Crossrefs

Programs

  • Mathematica
    Do[Do[If[PrimeQ[2n+2-Prime[k]]==True,Print[n," ",If[Mod[Prime[k],4]==3,(Prime[k]+1)/2,Prime[k]]];Goto[aa]],{k,PrimePi[n]+1,PrimePi[2n]}];
    Label[aa];Continue,{n,1,100}]
    nxt[{n_,a_}]:=Module[{p=NextPrime[n]},While[!PrimeQ[2(n+1)-p],p = NextPrime[ p]];{n+1,If[Divisible[p+1,4],(p+1)/2,p]}]; Rest[ Transpose[ NestList[ nxt,{1,2},110]][[2]]] (* Harvey P. Dale, May 30 2016 *)
  • PARI
    a(n)=my(q=nextprime(n+1)); while(!isprime(2*n+2-q),q=nextprime(q+1)); if(q%4<3,q,(q+1)/2) \\ Charles R Greathouse IV, Feb 28 2013