Computation of Bells Numbers

Return to Main

Unix BC code:
bc -l bells.b
Listing of bells.b
define bells (limit)
{
        b[1] = 1;
        l = 1;
        for (n = 1; n <= limit; n++) {
                for (m = 1; m < n; m++) {
                        lo = l;
                        l = l + b[m];
                        b[m] = lo;
                }
                b[m] = l;
                outl = l(l)/l(10) ;
                print "Bell(", n, ") = ";
		print "10^",  outl ," = ";
		print  l, "\n";
        }
}

scale=2
bells(1000);
quit;

More about BC Programming

The First 1000 Bells numbers