Stirling numbers of the second kind: Difference between revisions

Line 591:
 
{{FormulaeEntry|page=https://formulae.org/?script=examples/Stirling_numbers_of_the_second_kind}}
 
'''Solution'''
 
'''Version 1. Recursive'''
 
[[File:Fōrmulæ - Stirling numbers of the second kind 01.png]]
 
'''Test case 1. Show the Stirling numbers of the second kind, S₂(n, k), up to S₂(12, 12)'''
 
[[File:Fōrmulæ - Stirling numbers of the second kind 02.png]]
 
[[File:Fōrmulæ - Stirling numbers of the second kind 03.png]]
 
'''Version 2. Non recursive'''
 
A faster, non recursive version is presented. This construct a matrix.
 
[[File:Fōrmulæ - Stirling numbers of the second kind 04.png]]
 
'''Test case 1. Show the Stirling numbers of the second kind, S₂(n, k), up to S₂(12, 12)'''
 
[[File:Fōrmulæ - Stirling numbers of the second kind 05.png]]
 
(the result is the same as recursive version)
 
'''Test case 2. Find the maximum value of S₂(n, k) where n ≤ 100'''
 
[[File:Fōrmulæ - Stirling numbers of the second kind 06.png]]
 
[[File:Fōrmulæ - Stirling numbers of the second kind 07.png]]
 
=={{header|Go}}==
2,120

edits