>>  <<  Usr  Pri  JfC  LJ  Phr  Dic  Voc  !:  Help  Dictionary

Factorial !  0 0 0 Out Of (Combinations)

For a non-negative integer argument y, the definition is */>:i.y . In general, !y is Γ(1+y) (the gamma function). Thus:
   (*/1 2 3 4 5) , (!5)
120 120
              
   ]x=: 2 %~ 3 -~ i. 2 4
_1.5 _1 _0.5 0
 0.5  1  1.5 2
              
   !x
_3.54491 _ 1.77245 1
0.886227 1 1.32934 2
              
   ]fi=:!^:_1(24 25 2.1 9876)
4 4.02705 2.05229 7.33019
              
   ! fi
24 25 2.1 9876
  For non-negative arguments x!y is the number of ways that x things can be chosen out of y . More generally, x!y is (!y)%(!x)*(!y-x) . Thus:
   3!5
10
   (!5)%(!3)*(!5-3)
10
   1j2 ! 3.5
8.64269j16.9189

   ]y=:2&!^:_1 (45 4.1 30 123)
10 3.40689 8.26209 16.1924
   2 ! y
45 4.1 30 123

   ]x=:!&10^:_1 (2.5 45)
0.3433618 2
   x ! 10
2.5 45

The first table below illustrates the relation between the dyad ! and the table of binomial coefficients; the last two illustrate its relation to the figurate numbers:
   h=: 0,i=: i.5 [ j=: -1+i.5 [ k=: 5#1
   tables=: (,.h);(i,i!/i);(j,i!/j);(k,i(+/\^:)k)
   format=: ({. ,:&< }.)@":&.>
   format tables
+---+-----------+-------------------+--------------+
|+-+|+---------+|+-----------------+|+------------+|
||0|||0 1 2 3 4|||_1 _2  _3  _4  _5|||1 1  1  1  1||
|+-+|+---------+|+-----------------+|+------------+|
||0|||1 1 1 1 1||| 1  1   1   1   1|||1 1  1  1  1||
||1|||0 1 2 3 4|||_1 _2  _3  _4  _5|||1 2  3  4  5||
||2|||0 0 1 3 6||| 1  3   6  10  15|||1 3  6 10 15||
||3|||0 0 0 1 4|||_1 _4 _10 _20 _35|||1 4 10 20 35||
||4|||0 0 0 0 1||| 1  5  15  35  70|||1 5 15 35 70||
|+-+|+---------+|+-----------------+|+------------+|
+---+-----------+-------------------+--------------+
Figurate numbers of order zero are all ones; those of higher orders result from successive applications of subtotals (that is, sums over prefixes, or +/\). Those of order two are the triangular numbers, resulting from subtotals over the integers beginning with one.

m comb n generates all size m combinations of i.n :
   seed=: [: i.@(,&0)&.> <:@- {. 1:
   cf  =: i.@# ,.&.> ,&.>/\.@:(>:&.>)
   comb=: [: ; [ cf@[&0 seed

   3 comb 5
0 1 2
0 1 3
0 1 4
0 2 3
0 2 4
0 3 4
1 2 3
1 2 4
1 3 4
2 3 4


>>  <<  Usr  Pri  JfC  LJ  Phr  Dic  Voc  !:  Help  Dictionary