For example, if I have 4 integers, and each can be between 0 and 36, how many combinations are there?
If the numbers have appeared before, but in a new order, then this still counts as a new combination e.g
$$1,5,3,4$$ $$1,5,4,3$$
Are different combinations.
So how many combinations all together will there be?
Also, how can I write an algorithm that will give me all of these combinations? I need to write some code that will cycle though every combination. My best attempt so far is:
start
a=0,b=0,c=0,d=0
increment d by 1 until d=36
increment c by 1 and then repeat the last step
repeat this until c=36
increment b by 1 and repeat the last 3 steps
repeat this until b=36
increment a by 1 and repeat the last 4 steps
repeat this until a=36
However I do not know if this will even give me every combination. I just cant wrap my head around it. I also do not know if this is a very efficient algorithm. In code this will most likely be implemented with nested for-loops which may take a long time. Is there a better way?
Your psuedocode should be nested loops, with optional indentation for clarity.
And clearly that is just counting $37^4$, isn't it?