I tested the code. It compiles and runs just fine. I compared the checksum of the output from both Rust and this version, they are identical:
md5 5b185f9a67a426baf78aa3bbb5baf8df out_rust
md5 5b185f9a67a426baf78aa3bbb5baf8df out_ada
On top of that, I got this:
Rust:
real 0m0.702s
user 0m0.693s
sys 0m0.007s
Ada:
real 0m0.708s
user 0m0.706s
sys 0m0.000s
Why don't you use this version instead? The output is correct and identical to Rust's, and the performance is significantly better: just as fast as C and Rust, as expected.
I tested it with N = 10000. I see the issue now though.
Edit: I do not understand your reaction to me thanking you for bringing my (and possibly other people's) attention to the other implementation. It was genuine.
> You're reading-between-the-lines something that isn't there.
md5 5b185f9a67a426baf78aa3bbb5baf8df out_rust
md5 5b185f9a67a426baf78aa3bbb5baf8df out_ada
On top of that, I got this:
Rust:
real 0m0.702s
user 0m0.693s
sys 0m0.007s
Ada:
real 0m0.708s
user 0m0.706s
sys 0m0.000s
Why don't you use this version instead? The output is correct and identical to Rust's, and the performance is significantly better: just as fast as C and Rust, as expected.
Thanks for letting us know about its existence!