Project Euler 24 - Lexicographic Permutations

Official link: https://projecteuler.net/problem=24