I want to know how I can express an integer as a sum of integers with minimum variance. For ex : 21 can be expressed as 6+6+6+3 or 6+5+5+5 or 18+1+1+1 or ….. But the set (6,5,5,5) has the minimum variance. I want to program in android which can do this, given an integer and the number of elements in the set.
Share
try just dividing by the numbers in the set (21/4 = 5) and then adding the reminder to the numbers in the set
For example, take 23.