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 #26 Feb 03 2018 12:26:49
%S 6,7,3,4,3,3,2,6,3,2,2,3,3,6,3,2,2,4,3,3,2,1,3,2,1,4,2,5,2,2,2,3,1,3,
%T 3,1,2,3,3,2,2,3,2,5,2,1,2,3,1,2,2,1,3,3,1,3,2,2,2,3,2,6,1,2,3,1,2,5,
%U 2,4,2,2,3,3,1,3,2,1,2,3,2,1,3,2,1,2,2,1,3,2,1,1,1,2,2
%N Smallest m such that neither of the two odd numbers that bracket n^m is a prime.
%C The locution "the two odd numbers which bracket n^m" indicates the pair (n^m-1,n^m+1) for even n and (n^m-2,n^m+2) for odd n.
%C The initial records in this sequence are a(2)=6, a(3)=7, a(2055)=8. No higher value was found up to 5500000. It is not clear whether a(n) is bounded.
%C Heuristically, Prob(a(n) > m) ~ (2/log n)^m/m! as n -> infinity for fixed m. The sum over n diverges, so we should expect infinitely many a(n) > m. - _Robert Israel_, Aug 12 2014
%C a(215539779) = 9 is a record and there is no higher value up to 4*10^9. a(n) <= 3 for all even n > 2, since n-1 divides n^3-1 and n+1 divides n^3+1. - _Jens Kruse Andersen_, Aug 14 2014
%H Stanislav Sykora, <a href="/A245513/b245513.txt">Table of n, a(n) for n = 2..10000</a>
%e a(4)=3 because 4^1 and 4^2 are bracketed by the odd numbers (3,5) and (15,17) and each pair contains a prime, but 4^3 is bracketed by (63,65) which are both nonprimes.
%e a(5)=4 because 5^1, 5^2, and 5^3 are bracketed by odd pairs (3,7), (23,27) and (123,127) which all contain at least one prime. But 5^4 is bracketed by odd numbers (623,627) which are both composites.
%p f:= proc(n) local m,nm;
%p for m from 1 do
%p nm:= n^m;
%p if n::odd then if not isprime(nm+2) and not isprime(nm-2) then return(m) fi
%p elif not isprime(nm+1) and not isprime(nm-1) then return(m)
%p fi
%p od
%p end proc:
%p seq(f(n), n=2..1000); # _Robert Israel_, Aug 12 2014
%t a245513Q[n_Integer] := Module[{i},
%t Catch[For[i = 0, i <= 20, i++,
%t If[EvenQ[n],
%t If[! PrimeQ[n^i + 1] && ! PrimeQ[n^i - 1], Throw[i]],
%t If[! PrimeQ[n^i + 2] && ! PrimeQ[n^i - 2], Throw[i]]
%t ]]]]; a245513[n_Integer] := a245513Q /@ Range[2, n]; a245513[120] (* _Michael De Vlieger_, Aug 12 2014 *)
%o (PARI) avector(nmax)={my(n, k, d=2, v=vector(nmax));for(n=2, #v+1, d=3-d; k=1;while(1, if((!isprime(n^k-d))&&(!isprime(n^k+d)), v[n-1]=k; break, k++)););return(v);}
%o a=avector(10000) \\ For nmax=6000000 runs out of 1GB memory
%Y Cf. A245509, A245510, A245511, A245512, A245514.
%K nonn
%O 2,1
%A _Stanislav Sykora_, Jul 24 2014