Bell numbers: Difference between revisions

Content added Content deleted
(→‎{{header|RapidQ}}: Added a solution.)
(Bell numbers in Chipmunk Basic and GW-BASIC)
Line 537: Line 537:
B(14) = 190899322
B(14) = 190899322
</pre>
</pre>

==={{header|Chipmunk Basic}}===
{{works with|Chipmunk Basic|3.6.4}}
{{trans|ASIC}}
<syntaxhighlight lang="qbasic">100 cls
110 dim a(13)
120 for i = 0 to ubound(a) : a(i) = 0 : next i
130 n = 0
140 a(0) = 1
150 displayrow()
160 while n <= ubound(a)
170 a(n) = a(0)
180 j = n
190 while j >= 1
200 jm1 = j-1
210 a(jm1) = a(jm1)+a(j)
220 j = j-1
230 wend
240 n = n+1
250 displayrow()
260 wend
270 end
280 sub displayrow()
290 print "B(";
300 print right$(str$(n),2)") = " a(0)
310 return</syntaxhighlight>


==={{header|FreeBASIC}}===
==={{header|FreeBASIC}}===
Line 561: Line 587:
print n+1, bell(n+1)
print n+1, bell(n+1)
next n</syntaxhighlight>
next n</syntaxhighlight>

==={{header|GW-BASIC}}===
{{works with|Chipmunk Basic}}
{{works with|PC-BASIC|any}}
{{works with|QBasic}}
{{trans|Chipmunk Basic}}
<syntaxhighlight lang="qbasic">100 CLS
110 DIM A#(13)
120 FOR I = 0 TO UBOUND(A#) : A#(I) = 0 : NEXT I
130 N = 0
140 A#(0) = 1
150 GOSUB 280
160 WHILE N <= 13
170 A#(N) = A#(0)
180 J = N
190 WHILE J >= 1
200 JM1 = J-1
210 A#(JM1) = A#(JM1)+A#(J)
220 J = J-1
230 WEND
240 N = N+1
250 GOSUB 280
260 WEND
270 END
280 REM Display Row
290 PRINT "B(";
300 PRINT RIGHT$(STR$(N),2)") = " A#(0)
310 RETURN</syntaxhighlight>


==={{header|QuickBASIC}}===
==={{header|QuickBASIC}}===