A245459 Number of primes of the form k^n - 2^k for positive integers k.
0, 0, 1, 4, 3, 2, 3, 5, 1, 4, 2, 4, 0, 6, 2, 2, 1, 2, 3, 5, 1, 9, 1, 4, 2, 3, 1, 2, 2, 2, 1, 4, 1, 5, 1, 2, 3, 3, 1, 2, 2, 1, 0, 3, 0, 1, 1, 2, 1, 4, 0, 1, 0, 3, 0, 3, 0, 2, 1, 4, 5, 3, 0, 3, 5, 9, 1, 5, 1, 6, 1, 0, 1, 4, 1, 1, 0, 4, 1, 4, 0, 3, 1, 0, 0, 7, 1, 4
Offset: 1
Keywords
Examples
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).
Links
- Jinyuan Wang, Table of n, a(n) for n = 1..450
Programs
-
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 *)
-
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
Formula
a(n) = |{k from positive integers: k^n - 2^k = prime}| for n >= 1. - Wolfdieter Lang, Aug 15 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
Comments