Bell number B(n) is defined as the number of ways of splitting n into any number of parts, also defined as the sum of previous $n$ Stirling numbers of second kind.
Wikpedia page gives the following python code to print bell polynomials,here is the link which returns the $n^{th}$ Bell number.(this can also be found on the wikipedia page if scrolled down)
but when I use the Dobinski formula , and write the following code(in python),
import math ITERATIONS = 1000 def bell_number(N): return (1/math.e) * sum([(k**N)/(math.factorial(k)) for k in range(ITERATIONS)])
I get a different answer
for instance,
$5^{th}$ bell number according to the code provided by wikipedia is $52$ but what the other code returns is $50.767362881659039$
Can you throw some light on this matter, as to why am I getting different answer (possibly incorrect) using Dobinski formula ?
P.S. Is this question inappropriate for this site, if yes then where else must I ask this?