cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A245459 Number of primes of the form k^n - 2^k for positive integers k.

Original entry on oeis.org

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

Views

Author

Juri-Stepan Gerasimov, Jul 22 2014

Keywords

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) -

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).
		

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