We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
My Approach - First find all possible numbers that a K-digit number could have
for example I treated [1,2,3],[2,1,3],[1,3,2],[2,3,1],[3,1,2],[3,2,1] all as same and I find only one of
them and not repeated numbers with same digits (using recursive appraoch) since what we are interested in only digits which constitute
K-digit number . this way my algorithm is very fast and will also work if N (input) is even more than 6 .
Project Euler #30: Digit Nth powers
You are viewing a single comment's thread. Return to all comments →
My Approach - First find all possible numbers that a K-digit number could have for example I treated [1,2,3],[2,1,3],[1,3,2],[2,3,1],[3,1,2],[3,2,1] all as same and I find only one of them and not repeated numbers with same digits (using recursive appraoch) since what we are interested in only digits which constitute K-digit number . this way my algorithm is very fast and will also work if N (input) is even more than 6 .