login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A338630 Least number of odd primes that add up to n, or 0 if no such representation is possible. 0

%I

%S 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 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 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 Least number of odd primes that add up to n, or 0 if no such representation is possible.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PrimePartition.html">Prime Partition</a>

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

%e 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 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 Cf. A051034, A065091.

%K nonn

%O 1,6

%A _Ilya Gutkovskiy_, Nov 04 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 24 12:30 EDT 2021. Contains 345416 sequences. (Running on oeis4.)