By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,882 Members | 2,460 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,882 IT Pros & Developers. It's quick & easy.

Every possible 3 digit combination generator

P: n/a
D
Hello everyone -
I'm trying to compile an application to generate all possible 3
digit combinations using 0-9 and a-z, I've looked everywhere for a
solution and I found Combinations! v 2.0 for windows, but I was more
looking to implement my own solution rather than buy software to
perform a small task. Thanks!

Jan 26 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
"D" <em*******@comcast.netwrote in message
news:11**********************@j27g2000cwj.googlegr oups.com...
Hello everyone -
I'm trying to compile an application to generate all possible 3
digit combinations using 0-9 and a-z, I've looked everywhere for a
solution and I found Combinations! v 2.0 for windows, but I was more
looking to implement my own solution rather than buy software to
perform a small task. Thanks!
Personally, I'd just nest three for/next loops and go through the ascii
values for 0-9 and when I hit 9, jump up to the ascii code for a. But I
doubt that's the right answer.

I bounced it off someone else, and he said he'd probably build an array of
the 36 elements and use that for the loops.

This honestly sounds like a homework assignment so I don't really feel
comfortable giving you actual code to do it.

Both of the solutions above would work, but I have no idea what the 'right'
answer (or method) would be. Personally, I've always been a bigger fan of
'It works' than of 'I did it the right way.'

Jan 26 '07 #2

P: n/a


On Jan 26, 1:31 pm, "D" <email0...@comcast.netwrote:
Hello everyone -
I'm trying to compile an application to generate all possible 3
digit combinations using 0-9 and a-z, I've looked everywhere for a
solution and I found Combinations! v 2.0 for windows, but I was more
looking to implement my own solution rather than buy software to
perform a small task. Thanks!
Shouldn't be too hard...
You'll need 3 nested loops:
Outer loop: changes the leftmost character
Middle loop: changes the middle character to every allowable digit for
each iteration of the Outer loop
Inner loop: changes the right character to every allowable digit
foreach iteration of the Middle loop.

pseudocode:

foreach left_character in [0-9a-z]
foreach middle_character in [0-9a-z]
foreach right_character in [0-9a-z]
print left_character,middle_character,right_character
endloop
endloop
endloop

I haven't actually tried proving this will work, but it looks pretty
close.

Jan 26 '07 #3

P: n/a
I can see how this could be very useful. One might wonder hmm is "2b9" a
valid 3-position alpha-numeric combination and then they could run the
program and keep an eye out for it. Or one might ask "how many gazillions of
combinations must that be" and now they could just run the program and count
them.

You might show us the code you have so far...

"D" <em*******@comcast.netwrote in message
news:11**********************@j27g2000cwj.googlegr oups.com...
Hello everyone -
I'm trying to compile an application to generate all possible 3
digit combinations using 0-9 and a-z, I've looked everywhere for a
solution and I found Combinations! v 2.0 for windows, but I was more
looking to implement my own solution rather than buy software to
perform a small task. Thanks!

Jan 26 '07 #4

P: n/a


On Jan 26, 3:01 pm, "Tom Leylan" <tley...@nospam.netwrote:
I can see how this could be very useful. One might wonder hmm is "2b9" a
valid 3-position alpha-numeric combination and then they could run the
program and keep an eye out for it. Or one might ask "how many gazillions of
combinations must that be" and now they could just run the program and count
them.

You might show us the code you have so far...
Well, if you just wanted to see if "2b9" was a "valid 3-position
alpha-numeric combination" then you could just use a pattern match,
maybe something like:
/[0-9a-z]{3}/

Jan 26 '07 #5

P: n/a


On Jan 26, 3:01 pm, "Tom Leylan" <tley...@nospam.netwrote:
I can see how this could be very useful. One might wonder hmm is "2b9" a
valid 3-position alpha-numeric combination and then they could run the
program and keep an eye out for it. Or one might ask "how many gazillions of
combinations must that be" and now they could just run the program and count
them.

You might show us the code you have so far...
....and if he just wanted to know how many combinations there are, it
would be a calculation of... umm... ok I forget how to do that one. ;)

But surely he must have a good reason for needing every possible
[0-9a-z]{3} string!!

Jan 26 '07 #6

P: n/a
Actually that determines if the value matched the pattern not if it is a
member of the set generated by the program. Yes they happen to intersect
but a proof of one is not proof of the other unless you prove the two
methods always intersect.

In any case my reply was tongue-in-cheek, what Earthly use could a printout
of all 3-position alpha-numeric strings be?
<lo*********@gmail.comwrote in message
news:11**********************@a75g2000cwd.googlegr oups.com...
>

On Jan 26, 3:01 pm, "Tom Leylan" <tley...@nospam.netwrote:
>I can see how this could be very useful. One might wonder hmm is "2b9" a
valid 3-position alpha-numeric combination and then they could run the
program and keep an eye out for it. Or one might ask "how many gazillions
of
combinations must that be" and now they could just run the program and
count
them.

You might show us the code you have so far...

Well, if you just wanted to see if "2b9" was a "valid 3-position
alpha-numeric combination" then you could just use a pattern match,
maybe something like:
/[0-9a-z]{3}/

Jan 26 '07 #7

P: n/a


>
You might show us the code you have so far......and if he just wanted to know how many combinations there are, it
would be a calculation of... umm... ok I forget how to do that one. ;)
Man it must be a friday :P ;)
.... (26+10)^3 = 46656

Jan 26 '07 #8

P: n/a

"Tom Leylan" <tl*****@nospam.netwrote in message
news:ei**************@TK2MSFTNGP03.phx.gbl...
>
what Earthly use could a printout of all 3-position alpha-numeric strings
be?
Not failing Programming 101. =) (ok, maybe 201)

Jan 26 '07 #9

P: n/a
In any case my reply was tongue-in-cheek, what Earthly use could a
printout of all 3-position alpha-numeric strings be?
>>
Could be used to check all available 3 digit domain names?
Jan 27 '07 #10

P: n/a
D
Just to be clear with everyone...this absolutely is not a homework
assignemnt :( what I actually need this for.....I work for a large
company that handles about 30,000 inbound contacts per day. As our
products improve/increase we are highering more and more staff. Our
current staff of approx 412 customer representatives (for our region)
handle 20 different areas on the east coast. Each area has a unique
set of codes, etc. that are used to identify products. Since we merged
multiple companies together these 3-digit combinations (which we use
as our Operator IDs) are appearing as duplicates...we are looking for
all possible 3-digit combinations to set up 100% unique Operator IDs
and maintain a database of those that are available in each "corp" or
area (of the 20 corps). I found various solutions out on the internet
regarding codes but nothing that I found useful, or correct is what I
should say. I did however find software for $20 - that seemed
reasonable for what I need this for, that produces the results I was
seeking. I appreciate everyone's responses, even those that appear to
be insulting, this has helped me to better understand what is
producing these results and I have noted this for future reference.
Thanks again everyone!

Jan 29 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.