OFFSET
1,4
COMMENTS
The values of k such that k^n - 2^k is prime for n = 1, 2, ..., 13 are
1) -
2) -
3) 3;
4) 3, 5, 7, 13;
5) 9, 19, 21;
6) 13, 17;
7) 3, 25, 31;
8) 3, 9, 13, 19, 29;
9) 13;
10) 9, 23, 31, 47;
11) 31, 45;
12) 7, 29, 41, 47;
13) -
LINKS
Jinyuan Wang, Table of n, a(n) for n = 1..450
FORMULA
a(n) = |{k from positive integers: k^n - 2^k = prime}| for n >= 1. - Wolfdieter Lang, Aug 15 2014
EXAMPLE
a(4) = 4 because 3^4 - 2^3 = 73 (prime), 5^4 - 2^5 = 593 (prime), 7^4 - 2^7 = 2273 (prime), 13^4 - 2^13 = 20369 (prime).
MAPLE
A245459:= proc(n)
local T, k, x;
T:= 0;
for k from 3 by 2 do
x:= k^n - 2^k;
if x <= 0 then return T fi;
if isprime(x) then T:= T+1 fi;
od:
end proc:
seq(A245459(n), n=1..100); # Robert Israel, Jul 23 2014
MATHEMATICA
a[n_] := Module[{cnt = 0, k, x}, For[k = 3, True, k = k+2, x = k^n-2^k; If[x <= 0, Return[cnt]]; If[PrimeQ[x], cnt++]]; cnt];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Feb 05 2023, after Robert Israel *)
PROG
(PARI)
a(n) = my(m=0, k=2); while(k^n>2^k, if(ispseudoprime(k^n-2^k), m++); k++); m
vector(80, n, a(n)) \\ Colin Barker, Jul 27 2014
(Python)
import sympy
def a(n):
..k = 2
..count = 0
..while k**n > 2**k:
....if sympy.isprime(k**n-2**k):
......count += 1
....k += 1
..return count
n = 1
while n < 100:
..print(a(n), end=', ')
..n += 1 # Derek Orr, Aug 02 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, Jul 22 2014
EXTENSIONS
Terms corrected by Robert Israel, Jul 23 2014
More terms from Colin Barker, Jul 27 2014
Name edited with k range given by Wolfdieter Lang, Aug 15 2014
More terms from Jinyuan Wang, Feb 24 2020
STATUS
approved