1
$\begingroup$

I have an exam later today and one of the problems I'm expecting is to divide a number to multiple integers. The results must be all positive integers. But the input may not be dividable into equal parts.

If I take 660 for example, and divided it to 7 pieces, I will get 94.28 which is not an integer. Rather I want an answer something like, 94 (5x) and 95 (2x). I know I could try out a couple of numbers, but I wanted to do it way more efficiently. Thanks in advance.

$\endgroup$
  • 1
    $\begingroup$ Best of luck for the exam $\endgroup$ – user265328 Dec 7 '15 at 11:26
3
$\begingroup$

I found one way, may not be the most efficient though.

First divide the number and forget the fractions.

  • 660/7 = 94.28 (forget 0.28) it becomes 94.
  • and 94 * 7 = 658,
  • 660 - 658 = 2 (you have this much extras)
  • Now you can add 2 to one part or add them to two parts
  • i.e 5x94, 2x95 or 6x94, 1x96
$\endgroup$
0
$\begingroup$

The Prime Factors of 660 are $2^2 \times 3 \times 5 \times 11$ so it can not be divided to more than 5 pieces (equal or not equal).

$\endgroup$
  • 1
    $\begingroup$ I think you may have missed the point of the question. In the question there is an example of splitting into 7 pieces (94,94,94,94,94,95,95). $\endgroup$ – Chris Dec 8 '15 at 12:41
  • 1
    $\begingroup$ With your explanation , now I am confused, yes I just dont get it. Is this about integer partitions or something ele? $\endgroup$ – jimjim Dec 8 '15 at 13:03
  • $\begingroup$ I've not heard the term "integer partitions" before but looking at wikipedia for 2 seconds I think it is. I think the example is best way to understand what is being asked for because for example the OP doesn't state except in the example that the integers need to be the same if possible or differ by one at most but that definitely seems to be what is required from the example and the answer they have given. Though the answer given has 6x94+1x96 so I'm really not sure about the actual requirements... $\endgroup$ – Chris Dec 8 '15 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.