Write a program, given an input n, will generate all possible n-tuples using natural numbers.
n=1
(1),(2),(3),(4),(5),(6)...
n=2
(1,1),(1,2),(2,1),(2,2),(1,3),(3,1),(2,3),(3,2),(3,3)...
n=6
(1,1,1,1,1,1) (1,1,1,1,2,1) (1,1,1,2,1,1)...
- The output may be in any order that does not break any other rules.
- The program must be written to run forever and list all applicable tuples exactly once, in theory.
- In reality, your program will reach your integer type's limit and crash. This is acceptable as long the program would run infinitely long if only your integer type was unlimited.
- Each valid tuple must be listed within finite time, if only the program were allowed to run that long.
- The output may, at your option, include zeroes in addition to the natural numbers.
- You may choose your program's output format for your convenience, as long as the separation between tuples and numbers inside each tuple is clear and consistent. (For example, one tuple per line.)
- The input (n) is an integer from one to six. Required behavior is undefined for inputs outside of this range.
- Code-golf rules apply, shortest program wins.
Thanks to "Artemis Fowl" for feedback during the sandbox phase.