473,414 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Every possible 3 digit combination generator

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
10 19900
"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


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
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


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


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
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


>
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

"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Chris Lasher | last post by:
Hello, I would like to create a set of very similar regular expression. In my initial thought, I'd hoped to create a regular expression with a variable inside of it that I could simply pass a...
36
by: rbt | last post by:
Say I have a list that has 3 letters in it: I want to print all the possible 4 digit combinations of those 3 letters: 4^3 = 64 aaaa
14
by: Alex Molochnikov | last post by:
Is there any way to embed the HTML code inside FRAMESET? Something like this: <frameset cols="50%,*"> <frame src=" ... HTML code for the frame ... "> <frame src="Frame2.html" name="main">...
2
by: Henry | last post by:
Hi, How can I generate an eight digit random? Can I use the staff name to generate it? May I ask is there any sample c# code to see? Thanks
0
by: James Dow Allen | last post by:
Roman Mashak wrote: These may be different "types" of typedefs than you had in mind, but when it isn't fully clear which integer type is best, I like new type-names so that the assumptions are...
28
by: beach.dk | last post by:
Hi, I'm trying to implement a simple hash algorith called rs_hash in javascript, but I cannot get a correct result. In c the code looks like this:
24
by: Yevgen Muntyan | last post by:
Hey, Is it correct that number of value bits in int and unsigned int representation may be the same? If it is so, then INT_MIN may be -(INT_MAX+1) (in mathematical sense), i.e. abs(INT_MIN) is...
2
by: dohertywa | last post by:
Hi: I'm working with probstat module which does an excellent job for the project I'm working on. I am passing the Combination objects I generate to generator functions that allow me to scale...
10
by: craigslist.jg | last post by:
let's say I have the following text: "4,300 value / 2,000,001 something else, 3,400, 500" I'm trying to come up with a regexp which will insert a $ sign at the begining of every number. After...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.