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.

A239279 Smallest k such that n^k - k^n is prime, or 0 if no such number exists.

This page as a plain text file.
%I A239279 #51 May 22 2025 10:21:37
%S A239279 5,1,1,14,1,20,1,10,273,14,1,38,1,68,0
%N A239279 Smallest k such that n^k - k^n is prime, or 0 if no such number exists.
%C A239279 It is believed that for all n > 4 and not in A097764, a(n) > 0.
%C A239279 a(n+1) = 1 if and only if n is prime.
%C A239279 If a(n) > 0 then a(n) and n are coprime.
%C A239279 If n is in the sequence A097764, then a(n) = 0 or 1 since n^k-k^n is factorable.
%C A239279 33^2570 - 2570^33 is a probable prime, so a(33) is probably 2570. - _Jon E. Schoenfield_, Mar 20 2014
%C A239279 Unknown a(n) values checked for k <= 10000 using PFGW. a(97) = 6006 found by _Donovan Johnson_ in 2005. The Lifchitz link shows some large candidates for larger n but a smaller k exists in many of those cases. - _Jens Kruse Andersen_, Aug 13 2014
%C A239279 Unknown a(n) values checked for k <= 15000 using PFGW.
%H A239279 H. Lifchitz and R. Lifchitz, <a href="http://www.primenumbers.net/prptop/searchform.php?form=x^y-y^x&amp;action=Search">PRP Top Records. Search for x^y-y^x</a>
%H A239279 Derek Orr, <a href="/A239279/a239279.txt">Table of n, a(n) for n = 2..99 (unknown k-values are marked "unknown")</a>
%e A239279 2^1-1^2 = 1 is not prime. 2^2-2^2 = 0 is not prime. 2^3-3^2 = -1 is not prime. 2^4-4^2 = 0 is not prime. 2^5-5^2 = 7 is prime. So a(2) = 5.
%o A239279 (Python)
%o A239279 import sympy
%o A239279 from sympy import isprime
%o A239279 from sympy import gcd
%o A239279 def Min(x):
%o A239279   k = 1
%o A239279   while k < 5000:
%o A239279     if gcd(k,x) == 1:
%o A239279       if isprime(x**k-k**x):
%o A239279         return k
%o A239279       else:
%o A239279         k += 1
%o A239279     else:
%o A239279       k += 1
%o A239279 x = 1
%o A239279 while x < 100:
%o A239279   print(Min(x))
%o A239279   x += 1
%o A239279 (PARI)
%o A239279 a(n)=k=1; if(n>4, forprime(p=1, 100, if(ispower(n)&&ispower(n)%p==0&&n%p==0, return(0)); if(n%p==n, break))); k=1; while(!ispseudoprime(n^k-k^n), k++); return(k)
%o A239279 vector(15, n, a(n+1))
%Y A239279 Cf. A072180, A109387, A117705, A117706, A128447, A128448, A128449, A128450.
%K A239279 nonn,hard,more
%O A239279 2,1
%A A239279 _Derek Orr_, Mar 14 2014