Problem with nested for-loops



Yesterday I came up with an interesting problem to which I'm unable to
provide any path for possible solutions.

Take n-tuple (a_1, ..., a_n) integers and create nested for loops as
int i = 0;
for b_1 from 1 to a_1
for b_2 from 1 to a_2
....
for b_n from 1 to a_n
i := i + 1

With given n-tuple this will produce some integer i. But if we are
given n and resulting i how would one find the n-tuple providing it?

Any ideas? Is this some known problem?

.