We're a place where coders share, stay up-to-date and grow their careers.
Haskell:
factorial :: (Integral a) => a -> a factorial n = product [1..n] choose :: (Integral a, Num b) => a -> a -> b n `choose` k = fromIntegral $ factorial n `div` (factorial k * factorial (n - k)) easyLine :: (Integral a, Num b) => a -> b easyLine n = (2 * n) `choose` n
From Wikipedia
The sum of the squares of the elements of row n equals the middle element of row 2n...In general form: ∑k=0n(nk)2=(2nn) \sum_{k = 0}^{n} {n \choose k}^2 = {2n \choose n} k=0∑n(kn)2=(n2n)
The sum of the squares of the elements of row n equals the middle element of row 2n...In general form:
p.s. I got to use the new latex feature for that!
Haskell:
From Wikipedia
p.s. I got to use the new latex feature for that!