25 lines
500 B
Text
25 lines
500 B
Text
/* Bell numbers */
|
|
|
|
Bell_nums:
|
|
procedure options(main);
|
|
%replace nmax by 9;
|
|
declare
|
|
a(0 : nmax) fixed binary(15),
|
|
(i, j, n) fixed binary(15);
|
|
n = 0;
|
|
do i = 0 to nmax - 1;
|
|
a(i) = 0;
|
|
end;
|
|
a(0) = 1;
|
|
put list('B(');
|
|
put edit(n, ') = ', a(0))(f(2), a, f(9));
|
|
do while (n < nmax);
|
|
a(n) = a(0);
|
|
do j = n to 1 by -1;
|
|
a(j - 1) = a(j - 1) + a(j);
|
|
end;
|
|
n = n + 1;
|
|
put skip list('B(');
|
|
put edit(n, ') = ', a(0))(f(2), a, f(9));
|
|
end;
|
|
end Bell_nums;
|