chandra sekaran on Wed, 09 Jul 2014 12:17:13 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Permutation and Combination how to find rank?


? digits(64235,256)
%1 = [250,235]


Nice it is giving for two variable ok, if we extend adding more varialbe how to solve as follwos


x*256+y = N  ( x,y <= 255)

255*256+255 = 65536


if x*256+y = 40000

y = 40000 % 256 = 64

x = 39936/256 = 156

156*256+64 = 40000

Here Mod will give y then we can calculate x.


In the same way if we extend the equation as follow


 x*256 + y*256 + z = N ( x,y,z <= 255)


 x*256 + y*256 + z = 104583

ANS: 158 * 256 + 250 * 256 + 135


gp > digits(104583,256)
%530 = [1, 152, 135]

how to get x,y,z using PARI how to solve fast.



how to get x,y,z using PARI how to solve.


On Wed, Jul 9, 2014 at 9:12 AM, chandra sekaran <sekar.bc@gmail.com> wrote:
Thank you for your reply.

In 256^2  let us take 235,250 and 250,235, 0,250  (0-255 total  256 values)

235,250 will occur on 235*256+ 250 = 60410

250,235 will occur on 250*256 + 235 = 64235.

0, 250 will occur on 0*256 + 250  = 250

I want to know any function available in PARI to tell by giving 64235 to get 250 and 255 and reverse. In same way for higher power also ( 256^3 - three combination and permutation, 256^4 - four combination and permutation and so on.)

Regards,

Chandrasekaran B



On Wed, Jul 9, 2014 at 12:07 AM, Charles Greathouse <charles.greathouse@case.edu> wrote:
I'm not sure what you're asking. You can use numtoperm and permtonum to convert a number to a permutation and vice versa:

> permtonum([3,1,2])
%1 = 4
> numtoperm(3,%)
%2 = [3, 1, 2]

Charles Greathouse
Analyst/Programmer
Case Western Reserve University


On Tue, Jul 8, 2014 at 2:18 PM, chandra sekaran <sekar.bc@gmail.com> wrote:
Hi ,

How to find rank in permutation and combination. For example

256^2 will give all possible permutation and combination. I want  know at 50000

what combination will come?  Using Pari how to calculate.

Regards,
Chandrasekaran B