Coin de Gamma
1 year ago
1 changed files with 16 additions and 0 deletions
@ -0,0 +1,16 @@
|
||||
use std::collections::HashSet; |
||||
|
||||
fn main() { |
||||
let mut ps = HashSet::new(); |
||||
let mut hs = HashSet::new(); |
||||
let N = 500000u64; |
||||
for n in 1..N { hs.insert(n*(2*n-1)); } |
||||
for n in 1..N { ps.insert(n*(3*n -1)/2 ); } |
||||
for n in 286u64..N { |
||||
let tn = n * (n+1)/2; |
||||
if !hs.contains(&tn) { continue; } |
||||
if !ps.contains(&tn) { continue; } |
||||
println!("{}", tn); |
||||
break; |
||||
} |
||||
} |
Loading…
Reference in new issue