Left factorials: Difference between revisions
Content deleted Content added
Added PascalABC.NET |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 2,319:
31678
35656</pre>
=={{header|Maxima}}==
<syntaxhighlight lang="maxima">
l_factorial(n):=sum(k!,k,0,n-1)$
/* Test cases */
makelist(l_factorial(i),i,0,10);
makelist(l_factorial(i),i,20,110,10);
</syntaxhighlight>
{{out}}
<pre>
[0,1,2,4,10,34,154,874,5914,46234,409114]
[128425485935180314,9157958657951075573395300940314,20935051082417771847631371547939998232420940314,620960027832821612639424806694551108812720525606160920420940314,141074930726669571000530822087000522211656242116439949000980378746128920420940314,173639511802987526699717162409282876065556519849603157850853034644815111221599509216528920420940314,906089587987695346534516804650290637694024830011956365184327674619752094289696314882008531991840922336528920420940314,16695570072624210767034167688394623360733515163575864136345910335924039962404869510225723072235842668787507993136908442336528920420940314,942786239765826579160595268206839381354754349601050974345395410407078230249590414458830117442618180732911203520208889371641659121356556442336528920420940314,145722981061585297004706728001906071948635199234860720988658042536179281328615541936083296163475394237524337422204397431927131629058103519228197429698252556442336528920420940314]
</pre>
=={{header|Nim}}==
Line 2,422 ⟶ 2,438:
%2 = [128425485935180314, 9157958657951075573395300940314, 20935051082417771847631371547939998232420940314, 620960027832821612639424806694551108812720525606160920420940314, 141074930726669571000530822087000522211656242116439949000980378746128920420940314, 173639511802987526699717162409282876065556519849603157850853034644815111221599509216528920420940314, 906089587987695346534516804650290637694024830011956365184327674619752094289696314882008531991840922336528920420940314, 16695570072624210767034167688394623360733515163575864136345910335924039962404869510225723072235842668787507993136908442336528920420940314, 942786239765826579160595268206839381354754349601050974345395410407078230249590414458830117442618180732911203520208889371641659121356556442336528920420940314, 145722981061585297004706728001906071948635199234860720988658042536179281328615541936083296163475394237524337422204397431927131629058103519228197429698252556442336528920420940314]
2565, 5733, 9128, 12670, 16322, 20062, 23875, 27749, 31678, 35656, </pre>
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
function lfact(n: integer): biginteger;
begin
result := 0;
var fact := 1bi;
for var i := 1 to n do
begin
result += fact;
fact *= i;
end;
end;
begin
for var n := 0 to 10 do lfact(n).Print;
println;
for var n := 2 to 11 do lfact(n * 10).println;
for var n := 1 to 10 do lfact(n * 1000).tostring.length.print;
end.
</syntaxhighlight>
{{out}}
<pre>
0 1 2 4 10 34 154 874 5914 46234 409114
128425485935180314
9157958657951075573395300940314
20935051082417771847631371547939998232420940314
620960027832821612639424806694551108812720525606160920420940314
141074930726669571000530822087000522211656242116439949000980378746128920420940314
173639511802987526699717162409282876065556519849603157850853034644815111221599509216528920420940314
906089587987695346534516804650290637694024830011956365184327674619752094289696314882008531991840922336528920420940314
16695570072624210767034167688394623360733515163575864136345910335924039962404869510225723072235842668787507993136908442336528920420940314
942786239765826579160595268206839381354754349601050974345395410407078230249590414458830117442618180732911203520208889371641659121356556442336528920420940314
145722981061585297004706728001906071948635199234860720988658042536179281328615541936083296163475394237524337422204397431927131629058103519228197429698252556442336528920420940314
2565 5733 9128 12670 16322 20062 23875 27749 31678 35656
</pre>
=={{header|Perl}}==
Line 4,089 ⟶ 4,141:
{{libheader|Wren-fmt}}
{{libheader|Wren-big}}
<syntaxhighlight lang="
import "./big" for BigInt
var lfacts = List.filled(12, BigInt.zero)
|