login
Number of partitions of n into pair of parts whose difference is a prime.
1

%I #21 Jan 22 2020 20:09:17

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

%T 10,1,10,1,11,1,11,1,12,1,13,1,13,1,14,1,14,1,14,1,15,1,15,1,15,1,16,

%U 1,17,1,17,1,17,1,18,1,18,1,19,1,20,1,20,1,20,1,21,1,21,1,22,1,22,1,22,1

%N Number of partitions of n into pair of parts whose difference is a prime.

%C Order of set A = { (p,q): p+q = n, q>=p and q-p is a prime}.

%C a(1) = a(2) = 0; for even n >= 4, a(n) = 1; for odd n >= 3, a(n) = pi(n-1) - 1, where pi(n) = A000720(n) is the prime counting function. - _Wesley Ivan Hurt_, Feb 01 2013

%H Antti Karttunen, <a href="/A084360/b084360.txt">Table of n, a(n) for n = 1..20000</a>

%F a(n) = ( pi(n-1)-2 )*( n mod 2 ) + 1 + floor(1/n) - floor(n/2)*floor(2/n). - _Wesley Ivan Hurt_, Feb 01 2013

%F a(n) = Sum_{i=1..floor(n/2)} A010051(n-2i). - _Wesley Ivan Hurt_, Apr 10 2018

%e a(7) = 2 and the partitions are (1,6) and (2,5).

%t a[1] = a[2] = 0; a[n_] := If[EvenQ[n], 1, PrimePi[n - 1] - 1]; Array[a, 90] (* _Jean-François Alcover_, Nov 24 2016, after _Wesley Ivan Hurt_ *)

%o (PARI) A084360(n) = if(n<=2,0,if(!(n%2),1,primepi(n-1)-1)); \\ _Antti Karttunen_, Jan 22 2020

%Y Cf. A000720, A010051, A082460.

%K nonn,easy

%O 1,7

%A _Amarnath Murthy_, May 27 2003

%E More terms from _Michel ten Voorde_, Jun 20 2003