Sha256: 1ef056abefa8defbe3efb3343d460307ae255fb630e045cc5555fe2071668e5b
Contents?: true
Size: 215 Bytes
Versions: 5
Compression:
Stored size: 215 Bytes
Contents
# coding: utf-8 class Integer def stirling2(m) n = self return 1 if (n.zero? and m.zero?) or m == n return 0 if m > n or m.zero? or n.zero? (n-1).stirling2(m-1) + m * (n-1).stirling2(m) end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
numb-0.186.0 | lib/numb/stirling2.rb |
numb-0.185.0 | lib/numb/stirling2.rb |
numb-0.184.0 | lib/numb/stirling2.rb |
numb-0.181.0 | lib/numb/stirling2.rb |
numb-0.170.0 | lib/numb/stirling2.rb |