i been searching the internet for few days now but haven't found good approach for my needs. so ill try asking.

Im looking for a way to generate all possible combinations of a number while each digit got different range.

let me give you an example:

my input: [1-3],[0-9],[4],[2-3]
few of the combinations will be:
1042
1043
1142
1143
1242
and so on...

1. the code **must not** store all of the combinations at some variable in memory, because i'll be working with big numbers (up to 10 digits) the program can make txt file with all the possibilities and write them one by one or just print them in console.
2. the input number length and the range for each digit is unknown until it been given. so no hard coded nested loops. it must be dynamic.

i hope i was clear..

tnx