the following piece of code gets the job done but it is not very efficient. Benchmarks throws:
0.018436 seconds (7.23 k allocations: 416.604 KiB, 99.90% compilation time)
Timewise it’s ok but I’m wondering about the allocations.
using Combinatorics
function ProblemXXX()
digits = [0,1,2,3,4,5,6,7,8,9]
_permutations = nthperm(digits, 1_000_000)
return join(_permutations)
end
I’m pretty sure it can be done in a more efficient way but I’m still a noob with Julia syntax.
Run it a second time. The first time you run a function, Julia compiles it for you. The second (and 3rd, 4th, 5th, etc) times are significantly faster: