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.

This page as a plain text file.
%I A138479 #22 Aug 10 2025 04:18:10
%S A138479 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,
%T A138479 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,
%U A138479 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
%N A138479 a(n) = smallest prime p such that 2*n + p^2 is another prime, or 0 if no such prime exists.
%C A138479 For numbers k such that a(k) = 0 see A138685.
%H A138479 Alois P. Heinz, <a href="/A138479/b138479.txt">Table of n, a(n) for n = 1..10000</a>
%H A138479 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Near-SquarePrime.html">Near-Square Prime</a>
%e A138479 11=2+3^2 hence a(1)=3,
%e A138479 13=4+3^2 hence a(2)=3,
%e A138479 31=6+5^2 hence a(3)=5.
%p A138479 a:= proc(n) local p;
%p A138479       if irem(n, 3)=1 and not isprime(2*n+9) then 0
%p A138479     else p:=2;
%p A138479          do p:= nextprime(p);
%p A138479             if isprime(2*n+p^2) then return p fi
%p A138479          od
%p A138479       fi
%p A138479     end:
%p A138479 seq(a(n), n=1..100);  # _Alois P. Heinz_, Jun 16 2014
%t A138479 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 *)
%t A138479 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 *)
%Y A138479 Cf. A002373, A020481, A049613, A059324 (?).
%K A138479 nonn
%O A138479 1,1
%A A138479 Philippe LALLOUET (philip.lallouet(AT)orange.fr), Mar 20 2008
%E A138479 More terms from _Artur Jasinski_ and _Farideh Firoozbakht_, Mar 26 2008