Crates.io | variable_base_factoradic |
lib.rs | variable_base_factoradic |
version | 0.0.1 |
source | src |
created_at | 2023-10-30 23:34:16.221954 |
updated_at | 2023-10-30 23:34:16.221954 |
description | Rust implementation of Randall Munroe's variable base factoradic number system: https://xkcd.com/2835/ |
homepage | https://soerface.github.io/variable_base_factoradic/ |
repository | https://github.com/soerface/variable_base_factoradic_rs |
max_upload_size | |
id | 1019195 |
size | 15,751 |
Implementation of https://xkcd.com/2835/
https://crates.io/crates/variable_base_factoradic
cargo install variable_base_factoradic
use variable_base_factoradic::VariableBaseFactoradicNumber;
// Convert from decimal to factoradic
let v = VariableBaseFactoradicNumber::try_new(5038).unwrap();
println!("{}", v.to_string()); // 654320
// Convert from factoradic to decimal
let v = "654320".parse::<VariableBaseFactoradicNumber>().unwrap();
println!("{}", v.value); // 5038