From 9bd496d356974c52d22ea59326b39ecbfbc81d9a Mon Sep 17 00:00:00 2001 From: daviddoji Date: Mon, 28 Aug 2023 18:47:48 +0200 Subject: [PATCH] Refactor output --- src/Julia/Problems001-050/Problem024.jl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Julia/Problems001-050/Problem024.jl b/src/Julia/Problems001-050/Problem024.jl index c0ef887..f1a3ea8 100644 --- a/src/Julia/Problems001-050/Problem024.jl +++ b/src/Julia/Problems001-050/Problem024.jl @@ -10,7 +10,7 @@ https://projecteuler.net/problem=24 =# using BenchmarkTools using Combinatorics -function Problem24() +function Problem024() #= 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 @@ -20,14 +20,16 @@ function Problem24() 012 021 102 120 201 210 What is the millionth lexicographic permutation of the digits - 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9? =# - digits = [0,1,2,3,4,5,6,7,8,9] + 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9? + =# + + digits = collect(0:9) _permutations = nthperm(digits, 1_000_000) return join(_permutations) end -println("Time to evaluate Problem $(lpad(24, 3, "0")):") -@btime Problem24() +println("Took:") +@btime Problem024() println("") -println("Result for Problem $(lpad(24, 3, "0")): ", Problem24()) +println("Result for Problem $(lpad(24, 3, "0")): ", Problem024())