Catalan numbers/Pascal's triangle: Difference between revisions
Content added Content deleted
(→ES6 JavaScript: Functional (distinguishing between first N element of series and Nth distinct Catalan number)) |
|||
Line 1,351: | Line 1,351: | ||
1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845 |
1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845 |
||
</pre> |
</pre> |
||
=={{header|smart BASIC}}== |
|||
-- [http://rosettacode.org/wiki/User:Sarossell Scott A. Rossell, 12-26-16] |
|||
<lang qbasic>PRINT "Catalan Numbers from Pascal's Triangle"!PRINT |
|||
x = 15 |
|||
DIM t(x+2) |
|||
t(1) = 1 |
|||
FOR n = 1 TO x |
|||
FOR m = n TO 1 STEP -1 |
|||
t(m) = t(m) + t(m-1) |
|||
NEXT m |
|||
t(n+1) = t(n) |
|||
FOR m = n+1 TO 1 STEP -1 |
|||
t(m) = t(m) + t(m-1) |
|||
NEXT m |
|||
PRINT n,"#######":t(n+1) - t(n) |
|||
NEXT n</lang> |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |