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.

A239475 Least number k such that k^n + n and k^n - n are both prime, or 0 if no such number exists.

This page as a plain text file.
%I A239475 #18 May 22 2025 10:21:37
%S A239475 4,3,2,0,42,175,66,3,2,4983,1770,55055,28686,18765,8456,0,594,128345,
%T A239475 136080,81,92,1163409,18810,10415,11754,3855,0,86043,38880,17639,
%U A239475 26088,37293,5540,612015,6876,0,44220,130425,110,9292527,1004850,1812149,442404,1007445,570658
%N A239475 Least number k such that k^n + n and k^n - n are both prime, or 0 if no such number exists.
%C A239475 a(n) = 0 iff n is of the form (pk)^p for some k and some prime p (See A097764).
%C A239475 gcd(n,a(n)) = 1 for all a(n) > 0.
%F A239475 a(A097764(n)) = 0 for all n.
%e A239475 1^1 +/- 1 = 2 and 0 are not both primes. 2^1 +/- 1 = 3 and 1 are not both primes. 3^1 +/- 1 = 4 and 2 are not both primes. 4^1 +/- 1 = 5 and 3 are both primes. Thus a(1) = 4.
%o A239475 (Python)
%o A239475 import sympy
%o A239475 from sympy import isprime
%o A239475 def TwoBoth(x):
%o A239475   for k in range(1,10**7):
%o A239475     if isprime(k**x+x) and isprime(k**x-x):
%o A239475       return k
%o A239475 x = 1
%o A239475 while x < 100:
%o A239475   if TwoBoth(x) != None:
%o A239475     print(TwoBoth(x))
%o A239475   else:
%o A239475     print(0)
%o A239475   x += 1
%o A239475 (PARI) a(n)=for(k=1,10^7,if(ispseudoprime(k^n-n)&&ispseudoprime(k^n+n),return(k)))
%o A239475 n=1;while(n<100,print1(a(n),", ");n++)
%Y A239475 Cf. A072883, A028870, A153974, A239413, A239414, A239415, A239416, A239417, A239418, A239474.
%K A239475 nonn
%O A239475 1,1
%A A239475 _Derek Orr_, Mar 20 2014