grains is easy

This commit is contained in:
Rorik Star Platinum 2025-12-10 18:04:56 +03:00
parent be07d4421e
commit 34eb2e1c4e
7 changed files with 247 additions and 0 deletions

7
rust/grains/src/lib.rs Normal file
View file

@ -0,0 +1,7 @@
pub fn square(s: u32) -> u64 {
2_u64.pow(s - 1)
}
pub fn total() -> u64 {
(1..=64).map(|x| square(x)).sum()
}