Skip to main content

euclid

Function euclid 

Source
pub fn euclid(k: usize, n: usize) -> Vec<bool>
Expand description

The Euclidean pattern of k onsets over n steps.

The grouping algorithm: start with k groups 1 and n - k groups 0, pair each leading group with one trailing group, keep the unpaired ones as the remainder, and repeat on the pairs and the remainder until at most one remainder group is left. At least one pairing step runs. k above n is cut to n.