login
Number of powers of 2 which can be subtracted from 3^n to form primes
2

%I #6 Nov 06 2012 04:04:40

%S 1,2,3,3,5,2,4,3,4,3,5,1,3,2,3,4,4,1,5,2,6,4,2,1,4,1,5,2,8,1,6,1,5,3,

%T 7,0,6,3,1,0,9,1,8,8,5,1,4,4,6,1,6,1,4,3,5,3,2,2,4,2,2,3,3,5,2,0,7,1,

%U 5,2,3,4,5,2,1,4,5,1,4,1,4,5,4,3,4,2,6,1,9,3,3,2,2,2,5,2,3,1,5,1,6,3,1,5,4

%N Number of powers of 2 which can be subtracted from 3^n to form primes

%C Note that if a 2^m is too large or too small, 3^n-2^m is either negative or fractional (respectively) and cannot ever be prime, thus 0 <= a(n) <= floor(n*log_2(3))

%C Zeros in this sequence are in A181484, which correspond to -1s in A180303

%e 3^1-2^0 = 2 which is prime, so a(1)=1

%e 3^3-{2^4,2^3,2^2,2^1,2^0} = {11,19,23,25,26}, three of which are prime, so a(3) = 3

%t np[n_]:=Module[{p2=2^Range[0,Floor[Log[2,3^n]]]},Count[3^n-p2,_?PrimeQ]]; Array[np,110] (* _Harvey P. Dale_, Nov 06 2012 *)

%Y Cf. A013604, A014224, A180303, A181484

%K nonn

%O 1,2

%A _Carl R. White_, Oct 23 2010