I want to create an array of tuples where each tuple is of length L and the sum of all elements come to a defined number.

I do have a solution currently, but it is not scalable till what I need, I get thrown an OutOfMemoryError().

Current solution:

```
function calc_combinations(C, n_var)
x = 0:C
comb = []
for i in Iterators.product(fill(x, n_var)...) |> collect
if sum(i) == C && !(i in comb)
push!(comb, i)
end
end
return comb
end
```

For larger numbers, for both n_var and C, I get thrown the error at Iterators.product(fill(x, n_var)ā¦) |> collect.

For my purpose, I only need to go till C=20 and n_var=8 at max (memory runs out at this point as well), but how would one go about making it much more efficient and also scalable as well, or if there is any other way to go about solving this problem.