Stirling numbers of the first kind, or Stirling cycle numbers, count permutations according to their number
of cycles (counting fixed points as cycles of length one).

They may be defined directly to be the number of permutations of n
elements with k disjoint cycles.

Stirling numbers of the first kind express coefficients of polynomial expansions of falling or rising factorials.

Depending on the application, Stirling numbers of the first kind may be "signed"
or "unsigned". Signed Stirling numbers of the first kind arise when the
polynomial expansion is expressed in terms of falling factorials; unsigned when
expressed in terms of rising factorials. The only substantial difference is that,
for signed Stirling numbers of the first kind, values of S1(n, k) are negative
when n + k is odd.

Stirling numbers of the first kind follow the simple identities:

   S1(0, 0) = 1
   S1(n, 0) = 0 if n > 0
   S1(n, k) = 0 if k > n
   S1(n, k) = S1(n - 1, k - 1) + (n - 1) * S1(n - 1, k) # For unsigned
     or
   S1(n, k) = S1(n - 1, k - 1) - (n - 1) * S1(n - 1, k) # For signed



Task

 Write a routine (function, procedure, whatever) to find Stirling numbers of the first kind. There are several methods to generate Stirling numbers of the first kind. You are free to choose the most appropriate for your language. If your language has a built-in, or easily, publicly available library implementation, it is acceptable to use that.
 Using the routine, generate and show here, on this page, a table (or triangle) showing the Stirling numbers of the first kind, S1(n, k), up to S1(12, 12). it is optional to show the row / column for n == 0 and k == 0. It is optional to show places where S1(n, k) == 0 (when k > n). You may choose to show signed or unsigned Stirling numbers of the first kind, just make a note of which was chosen.
 If your language supports large integers, find and show here, on this page, the maximum value of S1(n, k) where n == 100.


See also

 Wikipedia - Stirling numbers of the first kind
 OEIS:A008275 - Signed Stirling numbers of the first kind
 OEIS:A130534 - Unsigned Stirling numbers of the first kind


Related Tasks

 Stirling numbers of the second kind
 Lah numbers


/*REXX program to compute and display  (unsigned)  Stirling numbers   of the first kind.*/
parse arg lim .                                  /*obtain optional argument from the CL.*/
if lim=='' | lim==","  then lim= 12              /*Not specified?  Then use the default.*/
olim= lim                                        /*save     the original value of  LIM. */
lim= abs(lim)                                    /*only use the absolute value of  LIM. */
numeric digits max(9, 2*lim)                     /*(over) specify maximum number in grid*/
@.=;                                 @.0.0= 1    /*define the   (0, 0)th  value  in grid*/
        do n=0  for lim+1                        /* [↓]  initialize some  values  "   " */
        if n>0  then @.n.0 = 0                   /*assign value if  N > zero.           */
          do k=n+1  to lim
          @.n.k = 0                              /*zero some values in grid  if  K > N. */
          end   /*k*/
        end     /*n*/
max#.= 0                                         /* [↓]  calculate values for the grid. */
        do   n=1  for lim;           nm= n - 1
          do k=1  for lim;           km= k - 1
          @.n.k = @.nm.km  +  nm * @.nm.k        /*calculate an unsigned number in grid.*/
          max#.k= max(max#.k, @.n.k)             /*find the      maximum value   "   "  */
          max#.b= max(max#.b, @.n.k)             /*find the maximum value for all rows. */
          end   /*k*/
        end     /*n*/
 
        do k=1  for lim                          /*find max column width for each column*/
        max#.a= max#.a + length(max#.k)
        end   /*k*/
                                                 /* [↓]  only show the maximum value ?  */
w= length(max#.b)                                /*calculate max width of all numbers.  */
if olim<0  then do;  say 'The maximum value  (which has '      w      " decimal digits):"
                     say max#.b                  /*display maximum number in the grid.  */
                     exit                        /*stick a fork in it,  we're all done. */
                end
wi= max(3, length(lim+1) )                       /*the maximum width of the grid's index*/
say 'row'  center('columns', max(9, max#.a + lim), '═')    /*display header of the grid.*/
 
        do r=0  for lim+1;   $=                  /* [↓]  display the grid to the term.  */
          do c=0  for lim+1  until c>=r          /*build a row of grid, 1 col at a time.*/
          $= $  right(@.r.c, length(max#.c) )    /*append a column to a row of the grid.*/
          end   /*c*/
        say right(r,wi)  strip(substr($,2), 'T') /*display a single row of the grid.    */
        end     /*r*/                            /*stick a fork in it,  we're all done. */