Skip to content

Instantly share code, notes, and snippets.

@darklinden
Created May 17, 2024 03:09
Show Gist options
  • Save darklinden/f4f94c38d90ac95749260a3da908f970 to your computer and use it in GitHub Desktop.
Save darklinden/f4f94c38d90ac95749260a3da908f970 to your computer and use it in GitHub Desktop.
oh?
use num::BigInt;
fn main() {
let a = "-80538738812075974".parse::<BigInt>().unwrap();
let b = "80435758145817515".parse::<BigInt>().unwrap();
let c = "12602123297335631".parse::<BigInt>().unwrap();
let a3 = a.pow(3);
let b3 = b.pow(3);
let c3 = c.pow(3);
let sum = &a3 + &b3 + &c3;
println!("a: {:?} b: {:?} c: {:?}", a, b, c);
// a: -80538738812075974 b: 80435758145817515 c: 12602123297335631
println!(
"a^3 + b^3 = c^3: {:?} + {:?} + {:?} = {:?}",
a3, b3, c3, sum
);
// a^3 + b^3 = c^3: -522413599036979150280966144853653247149764362110424 + 520412211582497361738652718463552780369306583065875 + 2001387454481788542313426390100466780457779044591 = 42
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment