Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,19 +0,0 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
procedure Mfact is
|
||||
|
||||
function MultiFact (num : Natural; deg : Positive) return Natural is
|
||||
Result, N : Integer := num;
|
||||
begin
|
||||
if N = 0 then return 1; end if;
|
||||
loop
|
||||
N := N - deg; exit when N <= 0; Result := Result * N;
|
||||
end loop; return Result;
|
||||
end MultiFact;
|
||||
|
||||
begin
|
||||
for deg in 1..5 loop
|
||||
Put("Degree"& Integer'Image(deg) &":");
|
||||
for num in 1..10 loop Put(Integer'Image(MultiFact(num,deg))); end loop;
|
||||
New_line;
|
||||
end loop;
|
||||
end Mfact;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
multifact: function [n deg][
|
||||
if? n =< deg -> n
|
||||
else -> n * multifact n-deg deg
|
||||
switch n =< deg -> n
|
||||
-> n * multifact n-deg deg
|
||||
]
|
||||
|
||||
loop 1..5 'i [
|
||||
|
|
|
|||
|
|
@ -1,18 +1,13 @@
|
|||
(phixonline)-->
|
||||
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
|
||||
<span style="color: #008080;">function</span> <span style="color: #000000;">multifactorial</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">order</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #004080;">atom</span> <span style="color: #000000;">res</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">1</span>
|
||||
<span style="color: #008080;">if</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">></span><span style="color: #000000;">0</span> <span style="color: #008080;">then</span>
|
||||
<span style="color: #000000;">res</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">*</span><span style="color: #000000;">multifactorial</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">-</span><span style="color: #000000;">order</span><span style="color: #0000FF;">,</span><span style="color: #000000;">order</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
|
||||
<span style="color: #008080;">return</span> <span style="color: #000000;">res</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
|
||||
with javascript_semantics
|
||||
function multifactorial(integer n, order)
|
||||
atom res = 1
|
||||
while n>1 do
|
||||
res *= n
|
||||
n -= order
|
||||
end while
|
||||
return res
|
||||
end function
|
||||
|
||||
<span style="color: #004080;">sequence</span> <span style="color: #000000;">s</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #000000;">0</span><span style="color: #0000FF;">,</span><span style="color: #000000;">10</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">for</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">=</span><span style="color: #000000;">1</span> <span style="color: #008080;">to</span> <span style="color: #000000;">5</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #008080;">for</span> <span style="color: #000000;">j</span><span style="color: #0000FF;">=</span><span style="color: #000000;">1</span> <span style="color: #008080;">to</span> <span style="color: #000000;">10</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #000000;">s</span><span style="color: #0000FF;">[</span><span style="color: #000000;">j</span><span style="color: #0000FF;">]</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">multifactorial</span><span style="color: #0000FF;">(</span><span style="color: #000000;">j</span><span style="color: #0000FF;">,</span><span style="color: #000000;">i</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
|
||||
<span style="color: #7060A8;">pp</span><span style="color: #0000FF;">(</span><span style="color: #000000;">s</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
|
||||
<!--
|
||||
for i=1 to 5 do
|
||||
printf(1,"%d: %v\n",{i,apply(true,multifactorial,{tagset(10),i})})
|
||||
end for
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
Function multifactorial(n,d)
|
||||
If n = 0 Then
|
||||
multifactorial = 1
|
||||
Else
|
||||
For i = n To 1 Step -d
|
||||
If i = n Then
|
||||
multifactorial = n
|
||||
Else
|
||||
multifactorial = multifactorial * i
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End Function
|
||||
|
||||
For j = 1 To 5
|
||||
WScript.StdOut.Write "Degree " & j & ": "
|
||||
For k = 1 To 10
|
||||
If k = 10 Then
|
||||
WScript.StdOut.Write multifactorial(k,j)
|
||||
Else
|
||||
WScript.StdOut.Write multifactorial(k,j) & " "
|
||||
End If
|
||||
Next
|
||||
WScript.StdOut.WriteLine
|
||||
Next
|
||||
Loading…
Add table
Add a link
Reference in a new issue