| Crates.io | keta |
| lib.rs | keta |
| version | 0.3.3 |
| created_at | 2026-01-04 15:22:58.016224+00 |
| updated_at | 2026-01-05 13:23:31.399582+00 |
| description | A utility crate for digit operations (digits, radix support, palindrome, etc.) optimized for competitive programming. |
| homepage | |
| repository | https://github.com/twil3akine/keta |
| max_upload_size | |
| id | 2022042 |
| size | 32,949 |
A lightweight, zero-dependency Rust crate for digit operations, designed for competitive programming (AtCoder, etc.).
std. Fast compile times.digits()), sum them (digit_sum()), or reverse them (reverse()).digits_radix(2)).digit_product()), check digit existence (contains_digit()), or rearrange digits (make_max(), make_min()).Add this to your Cargo.toml:
[dependencies]
keta = "0.3.3"
use keta::Keta;
fn main() {
// 1. Decomposition (Decimal & Radix)
let n = 12345;
assert_eq!(n.digits(), vec![1, 2, 3, 4, 5]);
assert_eq!(6.digits_radix(2), vec![1, 1, 0]); // 6 in binary is 110
// 2. Aggregation (Sum & Product)
assert_eq!(n.digit_sum(), 15); // 1+2+3+4+5 = 15
assert_eq!(123.digit_product(), 6); // 1*2*3 = 6
assert_eq!(6.digit_sum_radix(2), 2); // 1+1+0 = 2
// 3. Rearrangement & Properties
assert_eq!(2026.make_max(), 6220);
assert_eq!(2026.make_min(), 226);
assert!(12345.contains_digit(3));
assert!(12321.is_palindrome());
assert_eq!(n.reverse(), 54321);
}
This project is licensed under the MIT LICENSE.