finish 16
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "euler16"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
rust-gmp = "*"
|
||||
@@ -0,0 +1,12 @@
|
||||
use gmp::mpz::Mpz;
|
||||
|
||||
fn main() {
|
||||
let x = Mpz::from(2);
|
||||
let y = x.pow(1000);
|
||||
let result: u128 = y
|
||||
.to_string()
|
||||
.chars()
|
||||
.map(|c| c.to_digit(10).unwrap() as u128)
|
||||
.sum();
|
||||
println!("{result}");
|
||||
}
|
||||
Reference in New Issue
Block a user