Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Bell-numbers/FreeBASIC/bell-numbers.basic
Normal file
22
Task/Bell-numbers/FreeBASIC/bell-numbers.basic
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#define MAX 21
|
||||
|
||||
#macro ncp(n, p)
|
||||
(fact(n)/(fact(p))/(fact(n-p)))
|
||||
#endmacro
|
||||
|
||||
dim as ulongint fact(0 to MAX), bell(0 to MAX)
|
||||
dim as uinteger n=0, k
|
||||
|
||||
fact(0) = 1
|
||||
for k=1 to MAX
|
||||
fact(k) = k*fact(k-1)
|
||||
next k
|
||||
|
||||
bell(n) = 1
|
||||
print n, bell(n)
|
||||
for n=0 to MAX-1
|
||||
for k=0 to n
|
||||
bell(n+1) += ncp(n, k)*bell(k)
|
||||
next k
|
||||
print n+1, bell(n+1)
|
||||
next n
|
||||
Loading…
Add table
Add a link
Reference in a new issue