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-6 of 6 results.

A245510 Records in A245509: smallest m > 1 such that the first odd number greater than m^k is prime for every 0 < k < n, but not for k = n.

Original entry on oeis.org

7, 5, 2, 105, 3, 909, 4995825, 28212939, 4836335472639, 223671748721751
Offset: 1

Views

Author

Stanislav Sykora, Jul 24 2014

Keywords

Comments

For more comments and a program, see A245509. a(9), if it exists, certainly exceeds 1050000000. It is not clear whether this sequence is infinite, nor whether a(n) is defined for every n.
For n > 3, a(n) is always odd, because A245509(i) can exceed 3 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 09 2022
From Jon E. Schoenfield, Sep 09 2022: (Start)
For any term m beyond a(8) that exists, each of the following holds:
m = p - 2, where p is a prime (so m is odd);
m == 0 (mod 3);
m == {-1, 0, 1} (mod 5);
m == {-1, 0, 1} (mod 11);
consequently, m mod 330 is one of 9 values: {21, 45, 99, 111, 165, 219, 231, 285, 309}.
(End)

Examples

			a(4) = 105 because 105 is the smallest m such that the first odd numbers after m^k are prime for k = 1,2,3, but composite for k = 4.
909+2, 909^2+2, 909^3+2, 909^4+2 and 909^5+2 are five primes, but 909^6+2 is composite, and 909 is minimal with this property. Therefore, a(6)=909 (and A245509(909)=6). - _Jeppe Stig Nielsen_, Sep 09 2022
		

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 < 29000000, 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, oo, 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
    
  • PARI
    upto(n)=v=vector(n);forstep(m=3,+oo,2,k=1;while(ispseudoprime(m^k+2),k++);if(k<=n&&v[k]==0,v[k]=m-(k==3)*7;print(v);vecprod(v)!=0&&return(v))) \\ Jeppe Stig Nielsen, Sep 09 2022

Extensions

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

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

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

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-6 of 6 results.