Jump to content

Bell numbers: Difference between revisions

1,112 bytes added ,  10 months ago
Initial FutureBasic task solution added
m (→‎{{header|BASIC}}: MaxN instead of confusing MaxIndex. Printing shortened.)
(Initial FutureBasic task solution added)
Line 1,767:
{{out}}
As above.
 
=={{header|FutureBasic}}==
FB does not yet offer native support for Big Ints.
<syntaxhighlight lang="futurebasic">
local fn BellNumbers( limit as long )
long j, n = 1
mda(0) = 1
printf @"%2llu. %19llu", n, mda_integer(0)
while ( n < limit )
mda(n) = mda(0)
for j = n to 1 step -1
mda(j - 1) = mda_integer(j - 1) + mda_integer(j)
next
n++
printf @"%2llu. %19llu", n, mda_integer(0)
wend
end fn
 
fn BellNumbers( 25 )
 
HandleEvents
</syntaxhighlight>
{{output}}
<pre>
1. 1
2. 2
3. 5
4. 15
5. 52
6. 203
7. 877
8. 4140
9. 21147
10. 115975
11. 678570
12. 4213597
13. 27644437
14. 190899322
15. 1382958545
16. 10480142147
17. 82864869804
18. 682076806159
19. 5832742205057
20. 51724158235372
21. 474869816156751
22. 4506715738447323
23. 44152005855084346
24. 445958869294805289
25. 4638590332229999353
</pre>
 
=={{header|Go}}==
723

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.