login
Let p = prime(n); a(n) = number of ways to write p = 2^i + q^j where i >= 0, j >= 1, q = odd prime.
5

%I #22 Jun 01 2024 11:15:31

%S 1,1,2,2,3,3,3,3,2,3,3,2,3,3,2,2,2,3,2,2,3,2,4,3,2,2,2,2,2,4,1,3,3,4,

%T 0,2,3,1,3,3,1,4,1,1,2,4,2,1,3,3,2,1,3,1,3,2,1,3,2,2,3,4,2,1,2,2,0,1,

%U 3,2,4,2,2,0,2,3,1,2,2,2,1,3,1,2,2,2,2,1,2,2,2,2,2,1,3,3,0,2,3,2,1,1,3,1,4

%N Let p = prime(n); a(n) = number of ways to write p = 2^i + q^j where i >= 0, j >= 1, q = odd prime.

%F a(n) = Sum_{k=1..prime(n)-1} A036987(k-1)*A000035(p-k)*A010055(p-k). - _Reinhard Zumkeller_, Apr 29 2010

%e n=25: A000040(25) = 97 = 2^6 + 3*11 = 2^5 + 5*13 = 2^4 + 3^4 = 2^3 + 89^1 = 2^2 + 3*31 = 2^1 + 5*19 = 2^0 + 3*2^5, therefore a(25) = #{[16+81], [8+89]} = 2.

%p From _Reinhard Zumkeller_, Apr 30 2010: (Start)

%p A000035 := proc(n) n mod 2 ; end proc:

%p A000108 := proc(n) binomial(2*n,n)/(n+1) ; end proc:

%p A036987 := proc(n) A000108(n) mod 2 ; end proc:

%p A010055 := proc(n) if n = 1 then 1; else numtheory[factorset](n) ; if nops(%) = 1 then 1; else 0; end if; end if: end proc:

%p A115230 := proc(n) p := ithprime(n) ; add(A036987(k-1)*A000035(p-k)*A010055(p-k), k=1..p-1) ; end proc: seq(A115230(n),n=1..40) ; # _R. J. Mathar_, Apr 30 2010 (End)

%t f[p_] := Length@ Table[q = p - 2^exp; If[ PrimeNu@ q == 1, {q}, Sequence @@ {}], {exp, 0, Floor@ Log2@ p}]; Table[ f[ Prime[ n]], {n, 105}] (* _Robert G. Wilson v_, Oct 05 2014 *)

%Y Cf. A115231-A115233, A000079, A061345.

%K nonn

%O 1,3

%A _Reinhard Zumkeller_, Jan 17 2006

%E Recomputed by _Charles R Greathouse IV_, _Ray Chandler_, _R. J. Mathar_, and _Reinhard Zumkeller_, Apr 29 2010; thanks to _Charles R Greathouse IV_, who pointed out that there were many errors in entries of A115230-A115233.

%E Edited by _N. J. A. Sloane_, Apr 30 2010

%E Formula corrected (thanks to _R. J. Mathar_, who found an error in it) by _Reinhard Zumkeller_, Apr 30 2010