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.

A245513 Smallest m such that neither of the two odd numbers that bracket n^m is a prime.

Original entry on oeis.org

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, 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, 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
Offset: 2

Views

Author

Stanislav Sykora, Jul 24 2014

Keywords

Comments

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.
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.
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
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

Examples

			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.
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.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local m,nm;
      for m from 1 do
        nm:= n^m;
        if n::odd then if not isprime(nm+2) and not isprime(nm-2) then return(m) fi
        elif not isprime(nm+1) and not isprime(nm-1) then return(m)
        fi
      od
    end proc:
    seq(f(n), n=2..1000); # Robert Israel, Aug 12 2014
  • Mathematica
    a245513Q[n_Integer] := Module[{i},
      Catch[For[i = 0, i <= 20, i++,
        If[EvenQ[n],
         If[! PrimeQ[n^i + 1] && ! PrimeQ[n^i - 1], Throw[i]],
         If[! PrimeQ[n^i + 2] && ! PrimeQ[n^i - 2], Throw[i]]
         ]]]]; a245513[n_Integer] := a245513Q /@ Range[2, n]; a245513[120] (* Michael De Vlieger, Aug 12 2014 *)
  • 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);}
    a=avector(10000)  \\ For nmax=6000000 runs out of 1GB memory