I can use any language right? How about MATLAB ;)
factor(factorial(n))
But here's a haskell solution just for fun:
import Data.List prime_factors :: Int -> [Int] prime_factors 1 = [] prime_factors n = next_factor : (prime_factors $ div n next_factor) where next_factor = head [i | i <- [2..n], 0 == mod n i] decomp :: Int -> [Int] decomp = sort . decomp' where decomp' 1 = [] decomp' n = prime_factors n ++ decomp' (n - 1)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I can use any language right? How about MATLAB ;)
But here's a haskell solution just for fun: