Is there a more efficient way to determine all possible values of 4 numbers that sum a particular value. I have used the following but if I expand it more then ten numbers per group or more then 4 groups it will be inefficient
Grid <- expand.grid(a=seq(0, 100, 10), b= seq(0,100,10), c= seq(0,100,10), d=seq(0,100,10))
Grid$total <- apply(Grid, 1, sum)
Grid[Grid$total==100,]
I my real application, the number will be percentages that will equal to 1 and will be adjusted by intervals of no less then 5