login
Least number k such that k^n - k^(n-1) + k^(n-2) - ... + (-1)^n is prime or 0 if no such k exists.
1

%I #14 Jul 19 2024 13:28:50

%S 3,2,2,2,0,2,0,0,0,2,0,2,0,0,0,2,0,2,0,0,0,2,0,0,0,0,0,7,0,2,0,0,0,0,

%T 0,16,0,0,0,61,0,2,0,0,0,6,0,0,0,0,0,10,0,0,0,0,0,6,0,2,0,0,0,0,0,5,0,

%U 0,0,46,0,18,0,0,0,0,0,2,0,0,0,49,0,0,0,0,0,16,0,0,0,0,0,0,0,70

%N Least number k such that k^n - k^(n-1) + k^(n-2) - ... + (-1)^n is prime or 0 if no such k exists.

%C If n is in A006093, then a(n) is not 0.

%C The only term where the converse is false is a(3) = 2. Also, 2 is the only such number that makes k^3 - k^2 + k - 1 prime. Otherwise, a(n) is not 0 iff n is in A006093.

%e 1^4 - 1^3 + 1^2 - 1^1 + 1 = 1 is not prime. 2^4 - 2^3 + 2^2 - 2^1 + 1 = 11 is prime. Thus a(4) = 2.

%o (PARI) a(n)=for(k=1,1000,s=k^n;if(ispseudoprime(s+sum(i=1,n,(-1)^i*k^(n-i))),return(k)))

%o n=1;while(n<100,print1(a(n),", ");n+=1)

%o (PARI) A243160(n) = if(3!=n && !isprime(1+n), 0, my(s); for(k=1, oo, s=k^n; if(isprime(s+sum(i=1, n, (-1)^i*k^(n-i))), return(k)))); \\ _Antti Karttunen_, Jul 19 2024

%Y Cf. A006093.

%K nonn

%O 1,1

%A _Derek Orr_, May 31 2014