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.

A138479 a(n) = smallest prime p such that 2*n + p^2 is another prime, or 0 if no such prime exists.

Original entry on oeis.org

3, 3, 5, 3, 3, 5, 3, 5, 5, 3, 3, 7, 0, 3, 7, 3, 3, 5, 3, 7, 5, 3, 5, 5, 3, 3, 5, 0, 3, 7, 3, 3, 29, 0, 3, 5, 3, 5, 5, 3, 5, 5, 0, 3, 7, 3, 3, 19, 3, 3, 5, 3, 5, 7, 0, 5, 5, 0, 3, 11, 3, 5, 5, 3, 3, 5, 0, 11, 5, 3, 3, 7, 0, 3, 7, 0, 3, 5, 3, 11, 7, 3, 5, 5, 3, 3, 5, 0, 7, 7, 3, 3, 5, 3, 3, 7, 0, 11, 5, 0
Offset: 1

Views

Author

Philippe LALLOUET (philip.lallouet(AT)orange.fr), Mar 20 2008

Keywords

Comments

For numbers k such that a(k) = 0 see A138685.

Examples

			11=2+3^2 hence a(1)=3,
13=4+3^2 hence a(2)=3,
31=6+5^2 hence a(3)=5.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) local p;
          if irem(n, 3)=1 and not isprime(2*n+9) then 0
        else p:=2;
             do p:= nextprime(p);
                if isprime(2*n+p^2) then return p fi
             od
          fi
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Jun 16 2014
  • Mathematica
    a = {}; Do[ p = 0; While[ (! PrimeQ[ 2*n + Prime[ p + 1 ]2 ]) && (p < 1000), p++ ]; If[ p < 1000, AppendTo[ a, Prime[ p + 1 ] ], AppendTo[ a, 0 ] ], {n, 1, 150} ]; a (* Artur Jasinski, Mar 26 2008 *)
    a[n_]:=If[Mod[n,3]!=1,(For[m=1,!PrimeQ[2n+Prime[m]^2],m++ ]; Prime[m]),If[ !PrimeQ[2n+9],0,3]];Table[a[n],{n,100}] (* Farideh Firoozbakht, Mar 28 2008 *)

Extensions

More terms from Artur Jasinski and Farideh Firoozbakht, Mar 26 2008