Jump to content
  • Advertisement
Sign in to follow this  
Themonkster

how to work out the number of Permutations?

This topic is 3755 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how many Permutations would it take to get to 1239, starting at 0000 then onto 1000, 1100 etc etc I don't want to loop because this is being used for a much greater amount of data. I am looking for some where to start from, any tips on where to look would be good.

Share this post


Link to post
Share on other sites
Advertisement
It isn’t really clear what you mean by permutations. A permutation is a sequence that contains each element of a finite set exactly once (look at the definitions on wikipedia for example). So if the set is {1,2,3} the permutations are 123, 132, 213, 231, 312, 321. I don’t know how to interpret your numbers. The numbers of permutations generated before a specific permutation depends in general by the algorithm used to create the partitions.

Share this post


Link to post
Share on other sites
yeah your right I meant interations.

I am basically wonder if there is a mathmatic way of working out how many iterations it would take to get from 0000 to 1239

Share this post


Link to post
Share on other sites
That doesn't make any more sense. What do you mean by "iterations"? What are the rules dictating what number you can get to next from a given number?

Share this post


Link to post
Share on other sites
Quote:
Original post by Themonkster
how many Permutations would it take to get to 1239,

starting at 0000 then onto 1000, 1100 etc etc

I don't want to loop because this is being used for a much greater amount of data.

I am looking for some where to start from,

any tips on where to look would be good.



Sorry,i cant help you.


Share this post


Link to post
Share on other sites
ok let me start again.

lets say I start with a string of 0000 and I want to get to 1239

I need to know how many times I would have to increment by 1 character

0000 would be 1, 0100 would be 2, 0010 would be 3 etc

I could just loop and figure it out from there but I am looking for another way.

@hjj589 thanks you have been so helpful and we needed to know that you can't help.

Share this post


Link to post
Share on other sites
But what do you mean by "increment by one character"? If you mean that each step is incrementing a single digit, then it's trivial: 1+2+3+9=15.

Share this post


Link to post
Share on other sites
Sorry but I continue to not understand your algorithm. You have given two examples of your algorithm:
0000 -> 1000 -> 1100 -> ..
0000 -> 0100 -> 0010 -> ...
The two aren’t compatible...

Can you write the code that generates all the sequences?

Share this post


Link to post
Share on other sites
Quote:
Original post by Themonkster
I am basically wonder if there is a mathmatic way of working out how many iterations it would take to get from 0000 to 1239


With this sequence: 0000, 0001, 0002, ..., 1237, 1238, 1239
You would need 1239 iterations.
So, in general, to get from A to B you'd need (B - A) iterations.

With this sequence: 0000, 0002, 0004, ..., 1236, 1238, 1240
You would never touch the value 1239 exactly (since it's an odd number), you would however reach 1238 in 619 iterations and 1240 in 620 iterations.

With this sequence: 0000, 1239
You reach your desired value in 1 iteration.

So, given what you've said so far, the answer is that the number of iterations required to get from a value, A to a value, B, lies in the interval: [0, ∞).
If you specify the rules for determining how you get from one value in the sequence to the next value then you can reduce the range of that inveral to something more useful.

Share this post


Link to post
Share on other sites
If the sequence is:
0000 1000 0100 0010 0001 1001 0101 0011 0002 1002 etc

Then the answer is 9 * 4 + 3 * 3 + 2 * 2 + 1 * 1 = 50.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!