Nuts, girl and boys

Milena collected fallen nuts and called a bunch of boys lets them share. She took a condition: the first boy takes one nut and a tenth of the rest, the second takes two nuts and tenth new rest, the third takes three nuts and tenth new rest, and so on. Thus managed to distribute all the nuts, and everyone got the same amount.

Determine how many nuts were gathered. Milena and many boys divided the nuts.

Correct answer:

nuts:  81
boys:  9

Step-by-step explanation:

Program in PHP:
for($o=2;$o<1000; $o++)
{
    $oo = $o;
    $ch = 1;

    $stack = array();
    do
    {
        $d = $ch + ($oo-$ch)/10;
        if($d != (int)$d)
        {
           continue(2);
        }
        $oo -= $d;
        $ch++;
        $stack[] = $d;
    }while($oo>0);

    if($oo==0)
    {
        echo "nuts=$o boys=$ch";
        print_r($stack);
        exit;
    }
}




Did you find an error or inaccuracy? Feel free to write us. Thank you!







You need to know the following knowledge to solve this word math problem:

Related math problems and questions: