1,105,290 Community Members

Say I have the set 0-3 what's an effecient way to

Member Avatar
Forte1292
Newbie Poster
22 posts since Mar 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

go through every combination ie(0,0,0,0),(0,0,0,1), .... ,(3,3,3,3)

But in a general way such that it's always 0-3, but it may be 4 digits or it may be 5 digits or any other number?

If I know the length I could do nested for loops, but since I don't...is there an effecient and general way to do it?

Member Avatar
mvmalderen
Nearly a Posting Maven
2,370 posts since Feb 2009
Reputation Points: 2,071 [?]
Q&As Helped to Solve: 282 [?]
Skill Endorsements: 40 [?]
 
2
 

It is basically the same as counting in base 4.

Question Answered as of 1 Year Ago by mvmalderen
Member Avatar
Forte1292
Newbie Poster
22 posts since Mar 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks!

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article