fork download
  1. import Data.List
  2.  
  3. c n k = div ( product [ n-k+1..n] )(product [1..k])
  4.  
  5. n x 0 = 1
  6. n x y | y < 0 = 0
  7. n x y | x < 0 = 0
  8.  
  9. n x y = sum [ n ( x-1 - k) (y-k) * c x k | k <-[0..y] ]
  10.  
  11. main = do
  12. mapM_ print $ take 10 [ map ( n x ) [1..x] | x<-[1..]]
Success #stdin #stdout 0.02s 5436KB
stdin
Standard input is empty
stdout
[1]
[3,1]
[6,7,1]
[10,25,15,1]
[15,65,90,31,1]
[21,140,350,301,63,1]
[28,266,1050,1701,966,127,1]
[36,462,2646,6951,7770,3025,255,1]
[45,750,5880,22827,42525,34105,9330,511,1]
[55,1155,11880,63987,179487,246730,145750,28501,1023,1]