A245511 Smallest m such that the largest odd number < n^m is not prime.
1, 1, 2, 3, 2, 3, 2, 4, 1, 1, 2, 3, 2, 4, 1, 1, 2, 4, 2, 3, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 3, 1, 1, 1, 1, 2, 2, 1, 1, 2, 3, 2, 2, 1, 1, 2, 3, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 2, 3, 2, 3, 1, 1, 1, 1, 2, 3, 1, 1, 2, 2, 2, 3, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1
Offset: 2
Keywords
Examples
a(2)=1 because 2^1-1 is 1, which is not a prime. a(5)=3 because the numbers 5^k-2, for k=1,2,3,.., are 3,23,123,... and the first nonprime among them corresponds to k=3.
Links
- Stanislav Sykora, Table of n, a(n) for n = 2..10000
Programs
-
Mathematica
f[n_] := Block[{m = 1, d = If[ OddQ@ n, 2, 1]}, While[t = n^m - d; EvenQ@ t || PrimeQ@ t, m++]; m]; Array[f, 105, 2] (* Robert G. Wilson v, Aug 04 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),v[n-1]=k;break,k++)););return(v);} a=avector(10000) \\ For nmax=6000000 runs out of 1GB memory
Comments