login
Primes of the form 2^a + 3^b.
9

%I #28 Apr 25 2016 12:04:59

%S 2,3,5,7,11,13,17,19,29,31,41,43,59,67,73,83,89,97,113,131,137,251,

%T 257,283,307,337,499,521,593,733,761,857,1033,1051,1753,2129,2203,

%U 2251,2699,2777,4099,4177,4339,6563,6569,6577,6689,8219,8273,8609,10657,14753

%N Primes of the form 2^a + 3^b.

%C Are a(3)=5, a(5)=11 and a(7)=17 the only cases with two ways of representation: {5=2^2+3^0=2^1+3^1, 11=2^3+3^1=2^1+3^2, 17=2^4+3^0=2^3+3^2}? - _Zak Seidov_, Feb 24 2015

%H T. D. Noe, <a href="/A004051/b004051.txt">Table of n, a(n) for n=1..1000</a>

%H Zak Seidov, <a href="/A004051/a004051.txt">Corresponding values of a and b.</a>

%t nMax = 15000; Union[Select[2^First[#] + 3^Last[#] & /@ Tuples[{Range[0, Log[2, nMax]], Range[0, Log[3, nMax]]}], # <= nMax && PrimeQ[#] &]] (* _Harvey P. Dale_, Mar 13 2011 *)

%o (MATLAB) n = 0; for a = 0:30 p1 = 2^a; for b = 0:19; p2 = 3^b; p3 = p1 + p2; if isprime(p3) n = n + 1; c(n) = p3; end; end; end; c = sort(c); k = size(c, 2); for i = 2:k if c(i-1) == c(i) c(i-1) = 0 end; end; c = sort(c); c = sym(c) % _Lei Zhou_, Jan 26 2005

%o (Haskell)

%o a004051 n = a004051_list !! (n-1)

%o a004051_list = filter ((== 1) . a010051'') a004050_list

%o -- _Reinhard Zumkeller_, May 20 2015

%Y Cf. A010051, subsequence of A004050.

%K nonn

%O 1,1

%A _N. J. A. Sloane_