Jump to content

Recommended Posts

Posted

This is the last missing piece I need to complete my compression algorithm, new one. Let's say I have 4 bits with 2 bits set as 1, 0011. The total number of permutations for this number is 0011, 0101, 0110, 1001, 1010, 1100, 6 cases. This can be computed using the calculation.

 

4! / ((2!)(4-2)!) = 6

 

Now I want to be able to find the nth sequence, for instance 1st number is 0011, second number is 0101. So if I say n=5, I want to be able to get the 5th permutation sequence 1010 from the initial 0011. How do I do this?

Posted (edited)

Right as I've mentioned I want 0011 to be 1, so having all the one bits on the right as 1, then slowly move to the left. It really doesn't matter as long as I can track the sequence in an orderly fashion. So I want to be able to derive a sequence using the nth value. For instance I want n=5 to get me 1010 in this case

 

P.S. We know how we can get any binary order using 2 to the power, for instance if I have n=15 I would get 15-2^3-2^2-2^1-2^0 and get 1111

Edited by fredreload
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.