Jump to content

Super-d numbers: Difference between revisions

m
Rust - performance improvement
(Added C solution)
m (Rust - performance improvement)
Line 864:
 
fn print_super_d_numbers(d: u32, limit: u32) {
use rug::ops::PowAssign;
use rug::Integer;
use rug::ops::Pow;
 
println!("First {} super-{} numbers:", limit, d);
Line 871:
let mut count = 0;
let mut n = 1;
let mut s = Integer::new();
while count < limit {
let s = .assign(Integer::fromu_pow_u(n).pow(, d) * d);
s *= d;
if s.to_string().contains(&digits) {
print!("{} ", n);
1,777

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.