cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A295629 Number of partitions of n into two parts such that not both are prime.

This page as a plain text file.
%I A295629 #25 Apr 01 2025 19:43:45
%S A295629 0,1,1,1,1,2,2,3,3,3,5,5,5,5,6,6,8,7,8,8,9,8,11,9,11,10,13,12,14,12,
%T A295629 14,14,15,13,17,14,18,17,18,17,20,17,20,19,21,19,23,19,23,21,25,23,26,
%U A295629 22,26,25,28,25,29,24,29,28,30,27,32,27,33,32,33,30
%N A295629 Number of partitions of n into two parts such that not both are prime.
%H A295629 Harvey P. Dale, <a href="/A295629/b295629.txt">Table of n, a(n) for n = 1..1000</a>
%H A295629 <a href="/index/Go#Goldbach">Index entries for sequences related to Goldbach conjecture</a>
%H A295629 <a href="/index/Par#part">Index entries for sequences related to partitions</a>
%F A295629 a(n) = Sum_{i=1..floor(n/2)} 1 - c(i) * c(n-i), where c = A010051.
%F A295629 a(n) = A004526(n) - A061358(n).
%e A295629 a(8) = 3; the partitions of 8 into two parts are (7,1), (6,2), (5,3) and (4,4). Since the parts in (7,1), (6,2) and (4,4) are not both prime, a(8) = 3.
%e A295629 a(11) = 5; the partitions of 11 into two parts are (10,1), (9,2), (8,3), (7,4) and (6,5). All of these have parts that are not both prime, so a(11) = 5.
%p A295629 N:= 1000: # to get a(1)..a(N)
%p A295629 P:= select(isprime, [2,seq(i,i=3..N,2)]):
%p A295629 A:= Vector(N,t -> floor(t/2)):
%p A295629 for i from 1 to nops(P) do
%p A295629   for j from i to nops(P) do
%p A295629     m:= P[i]+P[j];
%p A295629     if m > N then break fi;
%p A295629     A[m]:= A[m]-1;
%p A295629 od od:
%p A295629 convert(A,list); # _Robert Israel_, Dec 07 2017
%t A295629 Table[Sum[1 - (PrimePi[i] - PrimePi[i - 1]) (PrimePi[n - i] - PrimePi[n - i - 1]), {i, Floor[n/2]}], {n, 80}]
%t A295629 Table[Total[If[AllTrue[#,PrimeQ],0,1]&/@IntegerPartitions[n,{2}]],{n,70}] (* _Harvey P. Dale_, Jan 17 2024 *)
%o A295629 (PARI) a(n) = sum(i=1, floor(n/2), 1 - isprime(i)*isprime(n-i)) \\ _Iain Fox_, Dec 06 2017
%Y A295629 Cf. A004526, A010051, A061358.
%K A295629 nonn,easy
%O A295629 1,6
%A A295629 _Wesley Ivan Hurt_, Nov 24 2017