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.

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

This page as a plain text file.
%I A245509 #38 Sep 11 2022 00:48:57
%S A245509 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,
%T A245509 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,
%U A245509 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
%N A245509 Smallest m such that the first odd number after n^m is composite.
%C A245509 The locution "first odd number after n^m" means n^m+1 for even n and n^m+2 for odd n.
%C A245509 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.
%C A245509 From _Jeppe Stig Nielsen_, Sep 09 2022: (Start)
%C A245509 When n is odd, consider the numbers n+2, n^2+2, n^3+2, n^4+2, ... Then find the first term which is composite, and a(n) is the exponent of that term.
%C A245509 When n is even, consider the numbers n+1, n^2+1, n^3+1. Then a(n) is the exponent from the first term which is composite. For n even, we have a(n) <= 3, because n^3+1 = (n+1)(n^2-n+1) is always composite. (End)
%H A245509 Stanislav Sykora, <a href="/A245509/b245509.txt">Table of n, a(n) for n = 2..10000</a>
%e A245509 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.
%e A245509 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.
%e A245509 a(7)=1 because the odd number following 7^1 is 9, which is not prime.
%t A245509 a245509[n_Integer] := Catch[
%t A245509   Do[
%t A245509    If[CompositeQ[n^m + 1 + If[OddQ[n], 1, 0]]
%t A245509      == True, Throw[m]],
%t A245509    {m, 100}]
%t A245509   ]; Map[a245509,
%t A245509 Range[2, 10000]] (* _Michael De Vlieger_, Aug 03 2014 *)
%t A245509 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 *)
%o A245509 (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);}
%o A245509 a=avector(10000)  \\ For nmax=6000000 runs out of 1GB memory
%Y A245509 Cf. A245510, A245511, A245512, A245513, A245514.
%K A245509 nonn
%O A245509 2,1
%A A245509 _Stanislav Sykora_, Jul 24 2014