How do I get the code to work beyond a = 35?
echo '35 2' | ../rust/.cargo/target/e2/faac113191d70d/debug/permutations
thread 'main' panicked at /rustc/dd84b7d5eec3c20d7fcd13e6450af029d3cece9d/library/core/src/iter/traits/accum.rs:149:1:
attempt to multiply with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Here's the output of JavaScript source compiled to native executable with Facebook's Static Hermes
echo '35 2' | ./out/fopen
2 of 1.0333147966386144e+40 (0-indexed, factorial 1.0333147966386144e+40) => [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33,32,34]
The first number is incorrect. I think the resulting lexicographic permutation is correct.
With input 65
echo '65 2' | ./out/fopen
2 of 8.247650592082472e+90 (0-indexed, factorial 8.247650592082472e+90) => [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,63,62,64]