08-19-2018, 04:14 PM
Following on from this post, this program returns a list of the Bell numbers ( A000110 in OEIS) from 0 through n:
A simple modification of the above will return rows 0 through n of the Bell triangle, OEIS A011971:
Both programs require GoferLists and should be run in exact mode due to the size of the numbers involved.
These programs are adapted (i.e. shamelessly stolen) from the excellent Haskell and Python programs in the OEIS links above.
Code:
\<< I\->R \-> n
\<< 1 1 { 1 } 2. n
START OVER :: + Scanl DUP Last NEWOB SWAP
NEXT DROP n 1. + \->LIST
\>>
\>>
A simple modification of the above will return rows 0 through n of the Bell triangle, OEIS A011971:
Code:
\<< I\->R \-> n
\<< { 1 } 1. n
START DUPDUP Last NEWOB :: + Scanl
NEXT n 1. + \->LIST
\>>
\>>
Both programs require GoferLists and should be run in exact mode due to the size of the numbers involved.
These programs are adapted (i.e. shamelessly stolen) from the excellent Haskell and Python programs in the OEIS links above.