Re: [SLUG] [PIG] Enumerate possible permutations?

From: Kwan Lowe (kwan@digitalhermit.com)
Date: Fri Jul 07 2006 - 16:50:02 EDT


The permutation function for n items, taken k at a time is:
  n!/(n-k)!

For the below, 4 items taken 4 at a time:

  4!/(4-4)! = 4!/(0)! = 4!/1 = (4 * 3 * 2 * 1) = 24

> Levi,
>
> I beleive if memory servers there is a mathmatical
> formula that goes something like :
>
> Z= x^(q)+ X^(q)+ x^(q)
>
> Where Z is the total number of permutations
> and Q= total number of available slots.
>
>
> Forgive formula errors as this is nearly 28 years
> worth of memory involved.
>
> Peace
>
> Mark
>
> --- Levi Bard
> <taktaktaktaktaktaktaktaktaktak@gmail.com> wrote:
>
>> OK, piggers!
>>
>> Say you have four (in this instance) numbers: 0, 1,
>> 2, 3.
>> Can you determine a good way to programmatically
>> enumerate all the
>> possible permutations of these numbers?
>>
>> As in:
>> 0 1 2 3
>> 0 1 3 2
>> 0 2 1 3
>> 0 2 3 1
>> ...
>>
>> --
>> Tcsh: Now with higher FPS!
>> http://www.gnu.org/philosophy/shouldbefree.html
>>
> -----------------------------------------------------------------------
>> This list is provided as an unmoderated internet
>> service by Networked
>> Knowledge Systems (NKS). Views and opinions
>> expressed in messages
>> posted are those of the author and do not
>> necessarily reflect the
>> official policy or position of NKS or any of its
>> employees.
>>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> -----------------------------------------------------------------------
> This list is provided as an unmoderated internet service by Networked
> Knowledge Systems (NKS). Views and opinions expressed in messages
> posted are those of the author and do not necessarily reflect the
> official policy or position of NKS or any of its employees.
>

-- 
* The Digital Hermit   http://www.digitalhermit.com
* Unix and Linux Solutions   kwan@digitalhermit.com
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:37:17 EDT