just count from 0 to FFFFFF in HEX
or count from 0 to 16777216 and print each output in HEX
I'm sure there's a function for outputting a number in hex.

of course, displaying 16million numbers to the browser will be time consuming, to say the least. :P

Barry

At 03:59 PM 4/3/2003, you wrote:
Hi Folks,

I'm struggling with a permutation problem.

I want to take a set of characters (for example "012345678ABCDEF") and generate all permutations of length N, allowing characters to be repeated. For example, I could use this algorithm to generate all HTML hex colors by passing:

generatePermutations("012345678ABCDEF",6)

Granted, this example would output some 16,777,215 items, but it would be a handy thing.

Note that I could get these color values by running from 0 to FFFFFF in hex, but I am looking for something more general so I can play with anagrams, etc.

I have seen some algorithms that generate permutations, but I don't want all permutations of "012345678ABCDEF", I just want all 6-digit permutations.

I have searched all over for algorithms, and have beat my head against it, but it is just escaping me. Can anyone help?

thanks,

michael


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to