Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Nice!
Btw, foldl1 (and foldr1) do the same as foldl but without a starting value.
So 1 + foldl1 (mod . (k +)) [2 .. n] is equivalent.
'If "This is not about coding skills", it should not be in "codewars".'
I disagree. Programming isn't only about coding skills. Making assertions about what the return of a function can look like is an important part of it.
This kata forces you to either do a lot of unnecessary work or make clever assertions and make your life easy.
But I agree that it shouldn't be 8 kyu.
Programming is a very wide field. Yes, you can do alot of programming without much math knowledge, but that is only because you are using a lot of libraries that do the math for you. Somebody has to write all these libraries and they need to know all this "useless math crap". So, please don't be ignorant and recognize the actual usefullness of these katas.
If you don't want to dive into this sort of programming just skip those katas.
This comment is hidden because it contains spoiler information about the solution
I just want to add, that it is NOT necessary to find the primefactors of each factor in the factorial. That is just slow to do that and doesn't scale very well.
If we have [2..n] as the representation of the factorial and p a prime, we know that there are n/p (rounded down) numbers that singaly divide into p, n/p^2 numbers that doubaly divide into p and so on.
So we just add up: n/p + n/p^2 + n/p^3 + n/p^4 ... until p^k is bigger than n, since then every term will be equal to 0.
We do this for every p <= n and that's it.
I learned a lot about types in this kata, because I was forced to think about it more than I usually have to. Thanks, loooking forward to the next in this series.
Nice Kata, but isn't this rated a little too high?
I think this could be 5kyu or even 6 kyu.
Pattern matching should also be disallowed for Haskell, it basically is a guard and will be accepted as an answer right now.
Will i loose kata-points if i look at the problems solution after i already past the kata?