1
$\begingroup$

I need to find growing combinations of variables a, b, c etc. I don't know names of math things in English well, so my description of the problem will be in pseudocode. This is for a programming problem, but I want to understand the underlying mathematics. I would highly appreciate proper names of techniques used so I can look them up further.

Lets say we have a list of variables

L (a, b, c)

And one single variable l which is the maximum desired count of a single variable from L.

I need to find every combination of elements from L multiplied by numbers from 0 to l.

So, for l = 3 I expect the following result:

1a0b0c
0a1b0c
0a0b1c
1a1b0c
1a0b1c

... and so on until ...

3a3b3c
$\endgroup$
2
$\begingroup$

You can think of these combinations as 3-digit numbers in base $l+1$. For example, if $l=9$ then the solutions to your problem are in one-to-one correspondence with 3-digit decimal numbers, from 000 to 999. There are in total $(l+1)^3$ of them.

As an aside, it is not clear why you omitted 0a0b0c.

$\endgroup$
  • $\begingroup$ Thank you Yuval, I would not have thought of that! $\endgroup$ – Dreen Nov 26 '17 at 18:09

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.