login
Number of ways to write 2*n as an ordered sum of two numbers which are prime or 1.
4

%I #12 Dec 13 2022 03:46:58

%S 1,3,3,4,3,4,5,4,6,6,5,8,5,4,8,6,7,8,5,6,10,8,7,12,8,6,12,6,7,14,7,10,

%T 12,6,10,14,11,10,14,10,9,18,9,8,20,8,9,14,8,12,18,12,11,18,14,14,22,

%U 12,11,24,7,10,20,8,14,20,11,10,18,16,15,22,11,10,26,10,16,22,11,16,20,12

%N Number of ways to write 2*n as an ordered sum of two numbers which are prime or 1.

%C A001031(n) = floor((a(n)+1)/2); a(n) mod 2 = A010051(n). - _Reinhard Zumkeller_, Aug 28 2013

%H Reinhard Zumkeller, <a href="/A096139/b096139.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Go#Goldbach">Index entries for sequences related to Goldbach conjecture</a>

%e a(2)=3 because 4=1+3 or 4=2+2 or 4=3+1;

%e a(3)=3 because 6=1+5 or 6=3+3 or 6=5+1;

%e a(4)=4 because 8=1+7 or 8=3+5 or 8=5+3 or 8=7+1;

%e a(5)=3 because 10=3+7 or 10=5+5 or 10=7+3.

%o (Haskell)

%o a096139 n = sum (map a010051 gs') + fromEnum (1 `elem` gs')

%o where gs' = map (2 * n -) $ takeWhile (< 2 * n) a008578_list

%o -- _Reinhard Zumkeller_, Aug 28 2013

%o (PARI) { a(n) = local(s(n) = if(n==1,1,isprime(n))); sum(i=1,2*n,s(i)*s(2*n-i)); } \\ _Christian Krause_, Dec 06 2022

%Y Cf. A008578, A010051, A001031, A347744.

%K easy,nonn

%O 1,2

%A _David Stroup_, Jul 23 2004

%E Example extended and typo fixed by _Reinhard Zumkeller_, Aug 28 2013