# Generating all combinations in a given range

I want to generate all possible combinations within a given limit sequentially. For example, For 3digit number, if there are 3^9 possible combinations, is it possible to generate those combinations part by part like

1. 3^(0-5)-Part one
2. 3^(6-9)-Part two

Is there any rules/law?

• Just counting up will generate them: $000$, $001$, $002$, ..., $999$, or is this not what you are after? – Joppy Apr 24 '17 at 8:09
• I know it can be generated by counting. But I want to know is there any specific algorithm? – user269156 Apr 24 '17 at 12:00