recursive unequal dividing integer
<p>I'm currently working on a simple problem and seems like recursive algorithm is the natural solution, but really don't know how to start, advice, code or links would be appreciated.All I want is to divide random integer into 4 unequal parts, where each part must be minumum 20 and must be divisible by 10.</p>

<p>So here's how it should work: let's say I want number 200 to divide into 4 unequal parts.Now, the first part should hold a random number between 20 and the total(200) divided by 2, so if selected random number is 180, divided by 2, that's 90, first part would 90.Second part should also be between 20 and what's left,(200-90) 110, let's say 60 is selected, also divided by 2, that's now 30, second part is 30.Now third part, between 20 and 200-90-30(80), let's say 40, divided by 2, that's 20, and the third part is 20.So we have 90 + 30 + 20,thats 150, and the last part should be what's left, that's 200 - 150 = 50.The problem here is that before selecting specific number, it must be sure that if selected, it is possible to calculate other parts.Any idea how to start, where to look ? </p>
