login
Number of ways writing n-th prime as a sum of two primes.
8

%I #17 Oct 02 2020 18:37:43

%S 0,0,1,1,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,1,

%T 0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,

%U 0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1

%N Number of ways writing n-th prime as a sum of two primes.

%C a(n) = 1 if and only if n is in A006512. - _Robert Israel_, Apr 04 2018

%H Muniru A Asiru, <a href="/A062301/b062301.txt">Table of n, a(n) for n = 1..3000</a>

%p a:= n-> `if`(isprime(ithprime(n)-2), 1, 0):

%p seq(a(n), n=1..105); # _Alois P. Heinz_, Oct 02 2020

%t Table[Sum[(PrimePi[Prime[n] - i] - PrimePi[Prime[n] - i - 1]) (PrimePi[i] - PrimePi[i - 1]), {i, Floor[Prime[n]/2]}], {n, 100}] (* _Wesley Ivan Hurt_, Apr 04 2018 *)

%o (PARI) a(n) = isprime(prime(n) - 2) \\ _David A. Corneth_, Apr 04 2018

%o (GAP) P:=Filtered([1..1000],IsPrime);; a:=List(List(List(P, i -> Partitions(i,2)), k -> Filtered(k, i -> IsPrime(i[1]) and IsPrime(i[2]))),Length); # _Muniru A Asiru_, Apr 05 2018

%Y Equals A061358(A000040(n)).

%Y Cf. A006512, A014092, A025584.

%K nonn

%O 1,1

%A _Labos Elemer_, Jul 05 2001

%E Offset changed to 1 by _David A. Corneth_, Apr 04 2018