RosettaCodeData/Task/Left-factorials/11l/left-factorials.11l
2023-07-01 13:44:08 -04:00

15 lines
429 B
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

F left_fact(n)
BigInt result = 0
BigInt factorial = 1
L(i) 1 .. n
result += factorial
factorial *= i
R result
print(First 11 left factorials:)
print((0..10).map(i -> left_fact(i)))
print("\n20 through 110 (inclusive) by tens:")
L(i) (20..110).step(10)
print(left_fact(i))
print("\nDigits in 1,000 through 10,000 by thousands:")
print((1000..10000).step(1000).map(i -> String(left_fact(i)).len))