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.

Showing 1-7 of 7 results.

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

Original entry on oeis.org

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

Views

Author

Stanislav Sykora, Jul 24 2014

Keywords

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.
From Jeppe Stig Nielsen, Sep 09 2022: (Start)
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.
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)

Examples

			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.
		

Crossrefs

Programs

  • 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 *)
  • 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

A245511 Smallest m such that the largest odd number < n^m is not prime.

Original entry on oeis.org

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

Views

Author

Stanislav Sykora, Jul 24 2014

Keywords

Comments

The locution "largest odd number < n^m" means n^m-1 for even n and n^m-2 for odd n.
The record values in this sequence are a(2)=1, a(4)=2, a(5)=3, a(9)=4, a(279)=5, a(15331)=6, a(1685775)=7. No higher value was found up to 5500000 (see also A245512). It is not clear whether a(n) is bounded.

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.
		

Crossrefs

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

A245512 Records in A245511: smallest m > 1 such that the largest odd number less than m^k is prime for every 0 < k < n, but not for k = n.

Original entry on oeis.org

2, 4, 5, 9, 279, 15331, 1685775, 205670529, 129734299239, 148778622108171
Offset: 1

Views

Author

Stanislav Sykora, Jul 24 2014

Keywords

Comments

For more comments and a program, see A245511. a(9), if it exists, certainly exceeds 500000000. It is not clear whether this sequence is infinite, nor whether a(n) is defined for every n.
For n > 2, a(n) is always odd, because A245511(i) can exceed 2 only when i is odd. Therefore to find more terms, it suffices to find odd bases m such that m-2, m^2-2, m^3-2, m^4-2, ..., m^N-2 is a long list of primes. - Jeppe Stig Nielsen, Sep 14 2022

Examples

			a(3) = 5 because the odd numbers preceding 5^k, for k = 1,2,3, are 3, 23 and 123, and the first one which is not a prime corresponds to k = 3. Moreover, 5 is the smallest natural having this property.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{d = If[ OddQ@ n, 2, 1], m = 1, t}, While[t = n^m - d; EvenQ@ t || PrimeQ@ t, m++]; m]; t = Table[0, {25}]; k = 2; While[k < 210000000, a = f@ k; If[ t[[a]] == 0, t[[a]] = k; Print[{a, k}]]; k++]; t (* Robert G. Wilson v, Aug 04 2014 *)
  • PARI
    a(n) = for(k=1,10^6,c=0;for(i=1,n-1,if(isprime(k^i-(k%2)-1),c++));if(c==n-1&&!isprime(k^n-(k%2)-1),return(k)))
    n=1;while(n<10,print1(a(n),", ");n++) \\ Derek Orr, Jul 27 2014

Extensions

a(4) corrected by Derek Orr, Jul 27 2014
a(8) from Robert G. Wilson v, Aug 04 2014
a(9) from Kellen Shenton, Sep 13 2022
a(10) from Kellen Shenton, Sep 18 2022

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

A245514 Smallest m such that at least one of the two odd numbers which bracket n^m is not a prime.

Original entry on oeis.org

1, 1, 2, 2, 2, 1, 1, 3, 1, 1, 2, 1, 1, 3, 1, 1, 2, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
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)=1, a(4)=2, a(9)=3, a(102795)=4. No higher value was found up to 5500000. It is not clear whether a(n) is bounded.

Examples

			a(2)=1 because one of the two odd numbers (1,3) which bracket 2^1 is not a prime. a(5)=2 because 5^1 is bracketed by the odd numbers (3,7) which are both prime, while 5^2 is bracketed by the odd numbers (23,27), one of which is not a prime.
The number c=102795 is the smallest one whose powers c^1, c^2, c^3 are all odd-bracketed by primes, while c^4 is not.
		

Crossrefs

Programs

  • 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

A216930 Numbers k such that k + 2, k^2 + 2, k^3 + 2, k^4 + 2 and k^5 + 2 are all prime.

Original entry on oeis.org

1, 909, 11925, 358875, 959595, 1047585, 3673089, 3925635, 3973971, 4995825, 5519241, 6516015, 6832245, 7217805, 7422381, 9145809, 10929765, 11038071, 11477235, 11721291, 12015555, 12262791, 12280935, 13454349, 13508475, 14625849, 15320829, 15321489, 15332745
Offset: 1

Views

Author

Michel Lagneau, Sep 20 2012

Keywords

Comments

k^6 + 2 is also prime for k = 4995825, 11038071, ...
a(2) = 909 = A245510(6); a(10) = 4996825, the first k such that k^6 + 2 is also prime, is A245510(7). - Jon E. Schoenfield, Dec 24 2022

Crossrefs

Cf. A245510.
Intersection of A040976, A067201, A067200, A216974, and A216976.

Programs

  • Mathematica
    Select[Range[16000000], And@@PrimeQ/@(Table[n^i+2, {i, 1, 5}]/.n->#)&]
    Select[Range[16*10^6], AllTrue[2 + #^Range[5], PrimeQ] &] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Jun 24 2015 *)
  • Python
    from sympy import isprime
    def ok(n): return all(isprime(n**i+2) for i in range(1, 6))
    print([k for k in range(1, 2*10**7, 2) if ok(k)]) # Michael S. Branicky, Dec 24 2022

Formula

a(n) == 3 (mod 6) for n>1. - Alexandru Petrescu, Dec 24 2022

A357280 Smallest m such that m^k-2 and m^k+2 are prime for k=1..n.

Original entry on oeis.org

5, 9, 102795, 559838181, 27336417022509
Offset: 1

Views

Author

Kellen Shenton, Sep 24 2022

Keywords

Examples

			a(3) = 102795 because:
for k = 1; 102795^1-2 = 102793 and 102795^1+2 = 102797, both of which are prime, and
for k = 2; 102795^2-2 = 10566812023 and 102795^2+2 = 10566812027, both of which are prime, and
for k = 3; 102795^3-2 = 1086215442109873 and 102795^3+2 = 1086215442109877, both of which are prime, and
102795 is the smallest number with this property.
		

Crossrefs

Programs

  • PARI
    isok(m,n) = for (k=1, n, if(!isprime(m^k-2) || !isprime(m^k+2), return(0));); return(1);
    a(n) = my(m=1); while(!isok(m, n), m++); m; \\ Michel Marcus, Nov 14 2022
Showing 1-7 of 7 results.