login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) is the least prime p such that p^n - 2*n is prime, or -1 if there is no such p.
1

%I #7 Jul 07 2023 05:47:25

%S 5,3,2,3,3,13,127,-1,11,3,41,5,3,-1,307,79,5,-1,211,-1,41,991,83,61,

%T 439,-1,17,-1,5,199,859,-1,149,5,431,251,883,-1,18353,31,2969,991,229,

%U -1,7,137,5987,-1,1321,-1,2711,43,6653,1901,3,-1,587,197,7001,-1,1213,-1,367,839,1217,73,7,-1

%N a(n) is the least prime p such that p^n - 2*n is prime, or -1 if there is no such p.

%H Robert Israel, <a href="/A363883/b363883.txt">Table of n, a(n) for n = 1..1000</a>

%e a(5) = 3 because 3^5 - 2*5 = 233 is prime and no smaller prime works.

%p f:= proc(n) local p;

%p if not irreduc(X^n-2*n) then return -1 fi;

%p p:= 1;

%p while p < 10^7 do

%p p:= nextprime(p);

%p if isprime(p^n - 2*n) then return p fi;

%p if n mod (p-1) = 0 and 1-2*n mod p = 0 then return -1 fi;

%p od;

%p FAIL

%p end proc:

%p f(2):= 3:

%p map(f, [$1..100]);

%Y Cf. A363796.

%K sign

%O 1,1

%A _Robert Israel_, Jun 25 2023