login
Smallest number k such that k^n is the sum of numbers in a twin prime pair.
2

%I #21 Aug 06 2021 04:38:50

%S 8,6,2,150,96,324,6,1518,174,168,21384,18,20754,2988,2424,8196,3786,

%T 14952,34056,48,1620,8256,31344,1176,123360,147456,28650,132,90,12834,

%U 81126,11790,2340,9702,11496,33000,10716,66954,6816,234,109956,3012,6744,117654,19950,26550,8226,40584,23640,30660

%N Smallest number k such that k^n is the sum of numbers in a twin prime pair.

%C Schinzel's hypothesis H implies that a(n) exists for every n. [_Charles R Greathouse IV_, Sep 18 2011]

%F a(n) is the least k such that (1/2)*k^n - 1 and (1/2)*k^n + 1 are prime.

%p isA054735 := proc(n)

%p if type(n,'odd') then

%p false;

%p else

%p isprime(n/2-1) and isprime(n/2+1) ;

%p end if;

%p end proc:

%p A195336 := proc(n)

%p for k from 1 do

%p if isA054735(k^n) then

%p return k;

%p end if;

%p end do:

%p end proc:

%p for n from 1 do print(A195336(n)) ; end do: # _R. J. Mathar_, Sep 20 2011

%o (PARI) a(n)=my(k=2);while(!ispseudoprime(k^n/2-1)||!ispseudoprime(k^n/2+1),k+=2);k \\ _Charles R Greathouse IV_, Sep 18 2011

%o (Python)

%o from sympy import isprime

%o def cond(k, n): m = (k**n)//2; return isprime(m-1) and isprime(m+1)

%o def a(n):

%o k = 2

%o while not cond(k, n): k += 2

%o return k

%o print([a(n) for n in range(1, 25)]) # _Michael S. Branicky_, Aug 06 2021

%Y Cf. A054735.

%K nonn

%O 1,1

%A _Kausthub Gudipati_, Sep 16 2011

%E a(11)-a(50) from _Charles R Greathouse IV_, Sep 18 2011