Optimization possible or use parallel computing
问题 I have this problem where I need to find the number of sums of powers that are equal to a number. So for example: An input of 100 2 would yield an output of 3 because 100 = 10^2 = 6^2 + 8^2 = 1^2 + 3^2 + 4^2 + 5^2 + 7^2 and an input of 100 3 would yield an output of 1 because 100 = 1^3 + 2^3 + 3^3 + 4^3 So my function for solving this problem is: findNums :: Int -> Int -> Int findNums a b = length [xs | xs <- (drop 1 .) subsequences [pow x b | x <- [1..c]], foldr (+) (head xs) (tail xs) == a]