Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Edited Code for Stirling Paper
A word is flat if the sequence of leading letters is weakly increasing. The function is_flat, returns True if a word is flat and False otherwise.
The number of runs in a word is the number number of maximal contiguous weakly increasing subwords of . The function run_counter, returns the number of runs in a word.
To generate Stirling Permutations of order , we can take the list of Stirling Permutations of order and insert at any place in the word.
While not obvious, we can generate flattened Stirling Permutations of order by attempting to insert at every position in the word, and reject those words which are not flat.
dStarting with an empty list, we construct the flattened Stirling Permutations of each order, counting the total number of flattened Stirling Permutations as well as the number of flattened Stirling Permutations with a given number of runs.