open_pql/prim/math/combinatorics/
mod.rs

1mod comb_ranks;
2mod perm_range_cond_idx;
3
4pub use comb_ranks::{
5    combination_of_2_index_to_ranks, combination_of_2_ranks_to_index,
6    combination_of_3_index_to_ranks, combination_of_3_ranks_to_index,
7};
8pub use perm_range_cond_idx::range_cond_indices;
9
10#[inline]
11const fn nc2(n: u8) -> u8 {
12    n * (n - 1) / 2
13}
14
15// #[inline]
16// pub fn ncr_usize(n: usize, r: usize) -> usize {
17//     #[inline]
18//     fn factorial(n: usize) -> usize {
19//         (2..=n).fold(1, usize::wrapping_mul)
20//     }
21//
22//     if n == 0 {
23//         0
24//     } else {
25//         factorial(n) / factorial(n.saturating_sub(r)) / factorial(r)
26//     }
27// }