Refactor output
This commit is contained in:
parent
e2f035d386
commit
9bd496d356
@ -10,7 +10,7 @@ https://projecteuler.net/problem=24 =#
|
|||||||
using BenchmarkTools
|
using BenchmarkTools
|
||||||
using Combinatorics
|
using Combinatorics
|
||||||
|
|
||||||
function Problem24()
|
function Problem024()
|
||||||
#=
|
#=
|
||||||
A permutation is an ordered arrangement of objects. For example, 3124 is
|
A permutation is an ordered arrangement of objects. For example, 3124 is
|
||||||
one possible permutation of the digits 1, 2, 3 and 4. If all of the
|
one possible permutation of the digits 1, 2, 3 and 4. If all of the
|
||||||
@ -20,14 +20,16 @@ function Problem24()
|
|||||||
012 021 102 120 201 210
|
012 021 102 120 201 210
|
||||||
|
|
||||||
What is the millionth lexicographic permutation of the digits
|
What is the millionth lexicographic permutation of the digits
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, 8 and 9? =#
|
0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?
|
||||||
digits = [0,1,2,3,4,5,6,7,8,9]
|
=#
|
||||||
|
|
||||||
|
digits = collect(0:9)
|
||||||
_permutations = nthperm(digits, 1_000_000)
|
_permutations = nthperm(digits, 1_000_000)
|
||||||
return join(_permutations)
|
return join(_permutations)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
println("Time to evaluate Problem $(lpad(24, 3, "0")):")
|
println("Took:")
|
||||||
@btime Problem24()
|
@btime Problem024()
|
||||||
println("")
|
println("")
|
||||||
println("Result for Problem $(lpad(24, 3, "0")): ", Problem24())
|
println("Result for Problem $(lpad(24, 3, "0")): ", Problem024())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user