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.

A075556 Smallest prime p not occurring earlier such that p+n is a square, or 0 if no such p exists.

This page as a plain text file.
%I A075556 #15 Dec 08 2024 17:25:13
%S A075556 3,2,13,5,11,19,29,17,7,71,53,37,23,67,181,0,47,31,557,61,43,59,41,97,
%T A075556 0,199,73,197,167,139,113,89,163,191,109,0,107,83,157,401,103,79,101,
%U A075556 317,151,179,149,241,0,239,349,173,271,307,269,233,619,383,137,229
%N A075556 Smallest prime p not occurring earlier such that p+n is a square, or 0 if no such p exists.
%C A075556 a(n)=0 or 2*sqrt(n)+1 for square n.  Apparently the only cases where it is 2*sqrt(n)+1 are n=1, 4 and 9. - _Ralf Stephan_, Mar 30 2003, corrected by _Robert Israel_, Dec 07 2024
%H A075556 Robert Israel, <a href="/A075556/b075556.txt">Table of n, a(n) for n = 1..10000</a>
%p A075556 for n from 1 to 100 do
%p A075556   if issqr(n) then
%p A075556     r:= sqrt(n);
%p A075556     if isprime(2*r+1) and not assigned(S[2*r+1]) then R[n]:= 2*r+1; S[2*r+1]:= n else R[n] := 0 fi;
%p A075556   else
%p A075556     for k from ceil(sqrt(n)) do
%p A075556       if not assigned(S[k^2-n]) and isprime(k^2-n) then R[n]:= k^2-n; S[k^2-n]:= n; break fi;
%p A075556     od
%p A075556   fi;
%p A075556 od:
%p A075556 seq(R[i],i=1..100); # _Robert Israel_, Dec 06 2024
%o A075556 (PARI) v=vector(1000000); for(n=1, 100, f=0; forprime(p=2, 1000000, if(!v[p]&&issquare(p+n), f=p; break)); if(f, print1(f", "); v[f]=1, print1("0, ")));
%Y A075556 Cf. A075555, A075557.
%K A075556 nonn
%O A075556 1,1
%A A075556 _Amarnath Murthy_, Sep 23 2002
%E A075556 More terms from _Ralf Stephan_, Mar 30 2003