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.

A338630 Least number of odd primes that add up to n, or 0 if no such representation is possible.

This page as a plain text file.
%I A338630 #15 Feb 16 2025 08:34:00
%S A338630 0,0,1,0,1,2,1,2,3,2,1,2,1,2,3,2,1,2,1,2,3,2,1,2,3,2,3,2,1,2,1,2,3,2,
%T A338630 3,2,1,2,3,2,1,2,1,2,3,2,1,2,3,2,3,2,1,2,3,2,3,2,1,2,1,2,3,2,3,2,1,2,
%U A338630 3,2,1,2,1,2,3,2,3,2,1,2,3,2,1,2,3,2,3,2,1,2,3,2,3,2,3,2,1,2,3,2,1,2,1,2,3,2,1,2,1,2
%N A338630 Least number of odd primes that add up to n, or 0 if no such representation is possible.
%H A338630 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PrimePartition.html">Prime Partition</a>
%H A338630 <a href="/index/Go#Goldbach">Index entries for sequences related to Goldbach conjecture</a>
%e A338630 a(9) = 3 because 9 = 3 + 3 + 3 is a partition of 9 into 3 odd prime parts and there is no such partition with fewer terms.
%t A338630 Block[{f, a}, f[m_] := Block[{s = {Prime@ PrimePi@ m}}, KeySort@ Merge[#, Identity] &@ Reap[Do[If[# <= m, Sow[# -> s]; AppendTo[s, Last@ s], If[Last@ s == 3, s = DeleteCases[s, 3]; If[Length@ s == 0, Break[], s = MapAt[Prime[PrimePi[#] - 1] &, s, -1]], s = MapAt[Prime[PrimePi[#] - 1] &, s, -1]]] &@ Total[s], {i, Infinity}]][[-1, -1]] ]; a = f[105]; Array[If[KeyExistsQ[a, #], Min@ Map[Length, Lookup[a, #]], 0] &, Max@ Keys@ a]] (* _Michael De Vlieger_, Nov 04 2020 *)
%Y A338630 Cf. A051034, A065091.
%K A338630 nonn
%O A338630 1,6
%A A338630 _Ilya Gutkovskiy_, Nov 04 2020