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

A072883 Least k >= 1 such that k^n + n is prime, or 0 if no such k exists.

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 16, 3, 2, 1, 32, 1, 118, 417, 2, 1, 14, 1, 22, 81, 76, 1, 12, 55, 28, 15, 0, 1, 110, 1, 232, 117, 230, 3, 12, 1, 4, 375, 2, 1, 48, 1, 46, 15, 218, 1, 78, 7, 100, 993, 28, 1, 624, 13, 252, 183, 226, 1, 104, 1, 1348, 777, 1294, 0, 1806, 1, 306, 1815, 10, 1, 30, 1
Offset: 1

Views

Author

Benoit Cloitre, Aug 13 2002

Keywords

Comments

Because the polynomial x^n + n is reducible for n in A097792, a(27) and a(64) are 0. Although x^4 + 4 is reducible, the factor x^2 - 2x + 2 is 1 for x=1. - T. D. Noe, Aug 24 2004

Crossrefs

Cf. A097792 (n such that x^n + n is reducible).

Programs

  • Mathematica
    Table[If[MemberQ[{27, 64}, n], 0, k=1; While[ !PrimeQ[k^n+n], k++ ]; k], {n, 100}]
    (* Second program: *)
    okQ[n_] := n == 4 || IrreduciblePolynomialQ[x^n + n];
    a[n_] := If[!okQ[n], 0, s = 1; While[!PrimeQ[s^n + n], s++]; s];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jan 15 2019, from PARI *)
  • PARI
    isok(n) = (n==4) || polisirreducible(x^n+n);
    a(n) = if (!isok(n), 0, my(s=1); while(!isprime(s^n+n), s++); s); \\ adapted by Michel Marcus, Jan 15 2019
    
  • PARI
    apply( {A072883(n)=if(is_A097792(n), n==4, for(k=1, oo, ispseudoprime(k^n+n) && return(k)))}, [1..99]) \\ M. F. Hasler, Jul 07 2024
    
  • Python
    from sympy import isprime
    def A072883(n):
        if is_A097792(n): return int(n==4)
        for k in range(1,99**9):
            if isprime(k**n+n): return k # M. F. Hasler, Jul 07 2024

Extensions

More terms from T. D. Noe, Aug 24 2004

A097792 Numbers of the form 4k^4 or (kp)^p for prime p > 2 and k = 1, 2, 3, ....

Original entry on oeis.org

4, 27, 64, 216, 324, 729, 1024, 1728, 2500, 3125, 3375, 5184, 5832, 9261, 9604, 13824, 16384, 19683, 26244, 27000, 35937, 40000, 46656, 58564, 59319, 74088, 82944, 91125, 100000, 110592, 114244, 132651, 153664, 157464, 185193, 202500, 216000
Offset: 1

Views

Author

T. D. Noe, Aug 24 2004

Keywords

Comments

A result of Vahlen shows that the polynomial x^n + n is reducible over the integers for n in this sequence and no other n.

Crossrefs

Cf. A093324 (least k such that n^k+k is prime), A097764 (numbers of the form (kp)^p).

Programs

  • Mathematica
    nMax=500000; lst={}; k=1; While[4k^4<=nMax, AppendTo[lst, 4k^4]; k++ ]; n=2; While[p=Prime[n]; p^p<=nMax, k=1; While[(k*p)^p<=nMax, AppendTo[lst, (k*p)^p]; k++ ]; n++ ]; Union[lst]
  • PARI
    upto(n) = {my(res = List()); for(i = 1, sqrtnint(n \ 4, 4), listput(res, 4*i^4) ); forprime(p = 3, log(n), pp = p^p; for(k = 1, sqrtnint(n \ pp, p), listput(res, pp * k ^ p); ) ); listsort(res); res } \\ David A. Corneth, Jan 12 2019
    
  • PARI
    select( {is_A097792(n, p=0)= n%4==0 && ispower(n\4,4) || ((2 < p = ispower(n,,&n)) && if(isprime(p), n%p==0, foreach(factor(p)[,1], q, q%2 && n%q==0 && return(1))))}, [1..10^4]) \\ M. F. Hasler, Jul 07 2024
    
  • Python
    from sympy import isprime, perfect_power, primefactors
    def is_A097792(n):
        return n%4==0 and (perfect_power(n//4,[4]) or n==4) or (
            p := perfect_power(n)) and p[1] > 2 and (p[0]%p[1]==0 if isprime(p[1])
            else any(p[0]%q==0 for q in primefactors(p[1]) if q > 2))
    # M. F. Hasler, Jul 07 2024

Formula

Is a(n) ~ c * n^3? - David A. Corneth, Jan 12 2019

A239735 Least number k such that n*k^n +/- 1 are twin primes, or a(n) = 0 if no such number exists.

Original entry on oeis.org

4, 3, 4, 1, 570, 1, 1464, 54, 60, 14025, 1932, 1, 7194, 15, 3612, 0, 4746, 1, 540, 150, 7060, 138, 80094, 6160, 33480, 93135, 0, 366618, 26058, 1, 90510, 16836, 9824, 418875, 57246, 0, 182394, 64077, 14178, 943410, 36078, 1, 314520, 15870, 194942, 15044700, 241944, 3871, 308730
Offset: 1

Views

Author

Derek Orr, Mar 30 2014

Keywords

Comments

a(n) = 1 iff n is in A014574.
If a(n) = 0, then n is in A097764.
If a(n) > 1 then A367566(n) divides a(n). - Jon E. Schoenfield, Nov 23 2023

Examples

			1*1^1+1 (2) and 1*1^1-1 (0) are not both prime. 1*2^1+1 (3) and 1*2^1-1 (1) are not both prime. 1*3^1+1 (4) and 1*3^1-1 (2) are not both prime. 1*4^1+1 (5) and 1*4^1-1 (3) are both prime. So, a(1) = 4.
		

Crossrefs

Programs

  • Mathematica
    zeroQ[n_] := Module[{f = FactorInteger[n]}, pow = GCD @@ f[[;; , 2]]; n > 4 && AnyTrue[Divisors[pow], # > 1 && Divisible[n, #] &]];
    a[n_, kmax_] := Module[{k = 1}, If[zeroQ[n], 0, While[k <= kmax && ! And @@ PrimeQ[n*k^n + {-1, 1}], k++]; If[k < kmax, k, -1]]]; Table[a[n, 10^6], {n, 1, 25}] (* Amiram Eldar, Nov 18 2023, returns -1 if the search limit should exceed kmax *)
  • PARI
    bot(n) = for(k=1, 10^5, if(ispseudoprime(n*k^n-1), if(ispseudoprime(n*k^n+1), return(k))));
    n=1; while(n<100, print1(bot(n), ", "); n+=1)
    
  • PARI
    a(n) = if ((n==16) || (n==27) || (n==36) || (n==64) /* || (n== ... */, return(0)); my(k=1); while (!(ispseudoprime(n*k^n-1) && ispseudoprime(n*k^n+1)), k++); k; \\ Michel Marcus, Nov 18 2023

Extensions

a(46) from Giovanni Resta, Mar 31 2014
Showing 1-3 of 3 results.