Ralf Hemmecke
unread,Oct 24, 2025, 8:03:04 AM (7 days ago) Oct 24Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
  to fricas-devel
Ooops.
%%% (309) -> stirling1(0,0)$IntegerCombinatoricFunctions(Integer)
    (309)  0
                                                     Type: Integer
That should be 1, right?
    stirling1(n, m) ==
       -- Definition: (-1)^(n-m) S[n, m] is the number of
       -- permutations of n symbols which have m cycles.
       n < 0 or m < 1 or m > n => 0
       m = n => 1
       S.Sn = n => coefficient(S.Sp, convert(m)@Z :: N)
       x := monomial(1, 1)$SUP(I)
       S.Sn := n
       S.Sp := x
       for k in 1 .. convert(n-1)@Z repeat S.Sp := S.Sp * (x - k::SUP(I))
       coefficient(S.Sp, convert(m)@Z :: N)
It seems that the condition "m < 1" in the first line should only be 
applied if n>0, i.e. it should be:
       n < 0 or (n > 0 and m < 1) or m > n => 0
Probably the same problem in stirling2.
Ralf