Skip to content

Instantly share code, notes, and snippets.

View isosphere's full-sized avatar

Matthew Scheffel isosphere

View GitHub Profile
@isosphere
isosphere / hcn.rs
Created October 8, 2020 13:34
Highly Composite Number Function in Rust (Not Optimized)
/// Returns the largest highly composite number less than or equal to the given number.
/// There is nothing clever about this algorithm, it is slow.
/// # Arguments
/// * `maximum` - A reference to a number that the highly composite number must not exceed
/// # Examples
/// ```
/// assert_eq!(highest_highly_composite_number(&842), 840)
/// ```
fn highest_highly_composite_number<'a, T: 'a>(maximum: &T) -> T
where