Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #12 Sep 08 2022 08:45:13
%S 3,2,5,5,3,2,2,17,7,17,5,13,3,2,17,11,19,7,13,5,11,3,2,3,2,23,5,53,3,
%T 2,5,17,3,2,29,13,107,11,61,41,23,7,101,5,19,3,2,73,79,31,13,29,11,67,
%U 73,113,7,23,5,61,3,2,37,17,79,59,61,13,31,11,29,53,71,7,53,5,23,3,2,41,19
%N a(n) = smallest prime p such that p + n is a perfect power m^k, k >= 2.
%C Conjecture: every prime is contained in this sequence.
%e 2+8=10, 3+8=11, 5+8=13, 7+8=15, 11+8=19, 13+8, 17+8=25. 17 is the first prime that when added to 8 gives a perfect power, viz. 25.
%p A094787 := proc(n)
%p local i ;
%p for i from 1 do
%p if isA001597(ithprime(i)+n) then
%p return ithprime(i) ;
%p end if;
%p end do:
%p end proc:
%p seq(A094787(n),n=1..40) ; # _R. J. Mathar_, Nov 15 2019
%o (PARI) k(n,m) = for(j=1,m, forprime(x=2,n,if(ispower(x+j),print1(x",");break))) ispower(n) = { local(p,r,j); r = sqrt(n); for(j=2,floor(r), p = floor(log(n)/log(j)+.5); if(j^p ==n,return(1)); ); return(0) }
%o (Magma) a:=[]; for n in [1..81] do p:=2; while not IsPower(p+n) do p:=NextPrime(p); end while; Append(~a,p); end for; a; // _Marius A. Burtea_, Nov 15 2019
%K nonn
%O 1,1
%A _Cino Hilliard_, Jun 10 2004
%E Offset corrected by _R. J. Mathar_, Nov 15 2019