Left factorials: Difference between revisions
Content added Content deleted
(J) |
(started Haskell) |
||
Line 56: | Line 56: | ||
Digits in 1,000 through 10,000 by thousands: |
Digits in 1,000 through 10,000 by thousands: |
||
[2565, 5733, 9128, 12670, 16322, 20062, 23875, 27749, 31678, 35656]</pre> |
[2565, 5733, 9128, 12670, 16322, 20062, 23875, 27749, 31678, 35656]</pre> |
||
=={{header|Haskell}}== |
|||
<lang haskell>fact :: [Integer] |
|||
fact = scanl (*) 1 [1..] |
|||
leftFact :: [Integer] |
|||
leftFact = scanl (+) 0 fact |
|||
main :: IO () |
|||
main = do |
|||
print $ take 11 leftFact</lang> |
|||
{{out}} |
|||
<pre> |
|||
[0,1,2,4,10,34,154,874,5914,46234,409114] |
|||
</pre> |
|||
=={{header|J}}== |
=={{header|J}}== |