

A245509


Smallest m such that the first odd number after n^m is composite.


6



3, 5, 3, 2, 3, 1, 1, 3, 3, 2, 2, 1, 1, 3, 3, 2, 2, 1, 1, 3, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 3, 1, 1, 3, 3, 2, 2, 1, 1, 5, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 3, 2, 2, 2, 1, 1, 1, 1, 2, 3, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 3, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

2,1


COMMENTS

The locution "first odd number after n^m" means n^m+1 for even n and n^m+2 for odd n.
The first few records in this sequence are a(2)=3, a(3)=5, a(909)=6, a(4995825)=7. No higher value was found up to 5500000 (see also A245510). It is not clear whether a(n) is bounded.


LINKS

Stanislav Sykora, Table of n, a(n) for n = 2..10000


EXAMPLE

a(2)=3 because, for k=1,2,3,..., the first odd numbers after 2^k are 3, 5, 9,... and the first one which is not prime corresponds to k=3.
a(3)=5 because the first odd numbers following 3^k are 5, 11, 29, 83, 245, ... and the first one which is not prime corresponds to k=5.
a(7)=1 because the odd number following 7^1 is 9, which is not prime.


MATHEMATICA

a245509[n_Integer] := Catch[
Do[
If[CompositeQ[n^m + 1 + If[OddQ[n], 1, 0]]
== True, Throw[m]],
{m, 100}]
]; Map[a245509,
Range[2, 10000]] (* Michael De Vlieger, Aug 03 2014 *)
f[n_] := Block[{d = If[ OddQ@ n, 2, 1], m = 1, t}, While[t = n^m + d; EvenQ@ t  PrimeQ@ t, m++]; m]; Array[f, 105, 2] (* Robert G. Wilson v, Aug 04 2014 *)


PROG

(PARI) avector(nmax)={my(n, k, d=2, v=vector(nmax)); for(n=2, #v+1, d=3d; k=1; while(1, if(!isprime(n^k+d), v[n1]=k; break, k++)); ); return(v); }
a=avector(10000) \\ For nmax=6000000 runs out of 1GB memory


CROSSREFS

Cf. A245510, A245511, A245512, A245513, A245514.
Sequence in context: A021743 A057023 A332438 * A085849 A100481 A205009
Adjacent sequences: A245506 A245507 A245508 * A245510 A245511 A245512


KEYWORD

nonn


AUTHOR

Stanislav Sykora, Jul 24 2014


STATUS

approved



