Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,21 +0,0 @@
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_Ackermann is
function Ackermann (M, N : Natural) return Natural is
begin
if M = 0 then
return N + 1;
elsif N = 0 then
return Ackermann (M - 1, 1);
else
return Ackermann (M - 1, Ackermann (M, N - 1));
end if;
end Ackermann;
begin
for M in 0..3 loop
for N in 0..6 loop
Put (Natural'Image (Ackermann (M, N)));
end loop;
New_Line;
end loop;
end Test_Ackermann;

View file

@ -1,11 +0,0 @@
Func Ackermann($m, $n)
If ($m = 0) Then
Return $n+1
Else
If ($n = 0) Then
Return Ackermann($m-1, 1)
Else
return Ackermann($m-1, Ackermann($m, $n-1))
EndIf
EndIf
EndFunc

View file

@ -1,18 +0,0 @@
Global $ackermann[2047][2047] ; Set the size to whatever you want
Func Ackermann($m, $n)
If ($ackermann[$m][$n] <> 0) Then
Return $ackermann[$m][$n]
Else
If ($m = 0) Then
$return = $n + 1
Else
If ($n = 0) Then
$return = Ackermann($m - 1, 1)
Else
$return = Ackermann($m - 1, Ackermann($m, $n - 1))
EndIf
EndIf
$ackermann[$m][$n] = $return
Return $return
EndIf
EndFunc ;==>Ackermann

View file

@ -1,32 +0,0 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. Ackermann.
DATA DIVISION.
LINKAGE SECTION.
01 M USAGE UNSIGNED-LONG.
01 N USAGE UNSIGNED-LONG.
01 Return-Val USAGE UNSIGNED-LONG.
PROCEDURE DIVISION USING M N Return-Val.
EVALUATE M ALSO N
WHEN 0 ALSO ANY
ADD 1 TO N GIVING Return-Val
WHEN NOT 0 ALSO 0
SUBTRACT 1 FROM M
CALL "Ackermann" USING BY CONTENT M BY CONTENT 1
BY REFERENCE Return-Val
WHEN NOT 0 ALSO NOT 0
SUBTRACT 1 FROM N
CALL "Ackermann" USING BY CONTENT M BY CONTENT N
BY REFERENCE Return-Val
SUBTRACT 1 FROM M
CALL "Ackermann" USING BY CONTENT M
BY CONTENT Return-Val BY REFERENCE Return-Val
END-EVALUATE
GOBACK
.

View file

@ -1,8 +0,0 @@
proc A(m:int, n:int):int {
if m == 0 then
return n + 1;
else if n == 0 then
return A(m - 1, 1);
else
return A(m - 1, A(m, n - 1));
}

View file

@ -1,18 +0,0 @@
Fixpoint ack (m : nat) : nat -> nat :=
fix ack_m (n : nat) : nat :=
match m with
| 0 => S n
| S pm =>
match n with
| 0 => ack pm 1
| S pn => ack pm (ack_m pn)
end
end.
(*
Example:
A(3, 2) = 29
*)
Eval compute in ack 3 2.

View file

@ -1,13 +0,0 @@
Require Import Utf8.
Section FOLD.
Context {A : Type} (f : A → A) (a : A).
Fixpoint fold (n : nat) : A :=
match n with
| O => a
| S k => f (fold k)
end.
End FOLD.
Definition ackermann : nat → nat → nat :=
fold (λ g, fold g (g (S O))) S.

View file

@ -1,10 +1,6 @@
func ackerm m n .
if m = 0
return n + 1
elif n = 0
return ackerm (m - 1) 1
else
return ackerm (m - 1) ackerm m (n - 1)
.
if m = 0 : return n + 1
if n = 0 : return ackerm (m - 1) 1
return ackerm (m - 1) ackerm m (n - 1)
.
print ackerm 3 6

View file

@ -2,7 +2,7 @@ import extensions;
// --- Ackermann function ---
ackermann(m,n)
Ackermann(m,n)
{
if(n < 0 || m < 0)
{
@ -13,18 +13,18 @@ ackermann(m,n)
0 : { ^n + 1 }
! : {
n =>
0 : { ^ackermann(m - 1,1) }
! : { ^ackermann(m - 1,ackermann(m,n-1)) }
0 : { ^Ackermann(m - 1,1) }
! : { ^Ackermann(m - 1,Ackermann(m,n-1)) }
}
}
public program()
public Program()
{
for(int i:=0; i <= 3; i += 1)
{
for(int j := 0; j <= 5; j += 1)
{
Console.printLine("A(",i,",",j,")=",ackermann(i,j))
Console.printLine("A(",i,",",j,")=",Ackermann(i,j))
}
};

View file

@ -1,5 +0,0 @@
(defun ackermann (m n)
(cond ((zerop m) (1+ n))
((zerop n) (ackermann (1- m) 1))
(t (ackermann (1- m)
(ackermann m (1- n))))))

View file

@ -1,16 +0,0 @@
function ack(atom m, atom n)
if m = 0 then
return n + 1
elsif m > 0 and n = 0 then
return ack(m - 1, 1)
else
return ack(m - 1, ack(m, n - 1))
end if
end function
for i = 0 to 3 do
for j = 0 to 6 do
printf( 1, "%5d", ack( i, j ) )
end for
puts( 1, "\n" )
end for

View file

@ -1,20 +0,0 @@
class RosettaDemo
{
static public function main()
{
Sys.print(ackermann(3, 4));
}
static function ackermann(m : Int, n : Int)
{
if (m == 0)
{
return n + 1;
}
else if (n == 0)
{
return ackermann(m-1, 1);
}
return ackermann(m-1, ackermann(m, n-1));
}
}

View file

@ -1,11 +0,0 @@
function ackermann ([long] $m, [long] $n) {
if ($m -eq 0) {
return $n + 1
}
if ($n -eq 0) {
return (ackermann ($m - 1) 1)
}
return (ackermann ($m - 1) (ackermann $m ($n - 1)))
}

View file

@ -1,6 +0,0 @@
foreach ($m in 0..3) {
foreach ($n in 0..6) {
Write-Host -NoNewline ("{0,5}" -f (ackermann $m $n))
}
Write-Host
}

View file

@ -1,14 +0,0 @@
function Get-Ackermann ([int64]$m, [int64]$n)
{
if ($m -eq 0)
{
return $n + 1
}
if ($n -eq 0)
{
return Get-Ackermann ($m - 1) 1
}
return (Get-Ackermann ($m - 1) (Get-Ackermann $m ($n - 1)))
}

View file

@ -1,3 +0,0 @@
$ackermann = 0..3 | ForEach-Object {$m = $_; 0..6 | ForEach-Object {Get-Ackermann $m $_}}
$ackermann | Format-Wide {"{0,3}" -f $_} -Column 7 -Force

View file

@ -1,6 +1,6 @@
from functools import lru_cache
from functools import cache
@lru_cache(None)
@cache
def ack2(M, N):
if M == 0:
return N + 1

View file

@ -1,7 +0,0 @@
ackermann: func [m n] [
case [
m = 0 [n + 1]
n = 0 [ackermann m - 1 1]
true [ackermann m - 1 ackermann m n - 1]
]
]

View file

@ -1,16 +0,0 @@
ackermann: func [
m [integer!]
n [integer!]
] [
;; Small-m closed forms
case [
m = 0 [n + 1]
m = 1 [n + 2]
m = 2 [(2 * n) + 3]
m = 3 [
;; 2^(n+3) - 3
(to integer! power 2 (n + 3)) - 3
]
;; m >= 4 causes stack overflow
]
]

View file

@ -1,25 +0,0 @@
/*REXX program calculates and displays some values for the Ackermann function. */
/*╔════════════════════════════════════════════════════════════════════════╗
Note: the Ackermann function (as implemented here) utilizes deep
recursive and is limited by the largest number that can have
"1" (unity) added to a number (successfully and accurately).
*/
high=24
do j=0 to 3; say
do k=0 to high % (max(1, j))
call tell_Ack j, k
end /*k*/
end /*j*/
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
tell_Ack: parse arg mm,nn; calls=0 /*display an echo message to terminal. */
#=right(nn,length(high))
say 'Ackermann('mm", "#')='right(ackermann(mm, nn), high),
left('', 12) 'calls='right(calls, high)
return
/*──────────────────────────────────────────────────────────────────────────────────────*/
ackermann: procedure expose calls /*compute value of Ackermann function. */
parse arg m,n; calls=calls+1
if m==0 then return n+1
if n==0 then return ackermann(m-1, 1)
return ackermann(m-1, ackermann(m, n-1) )

View file

@ -1,21 +0,0 @@
/*REXX program calculates and displays some values for the Ackermann function. */
high=24
do j=0 to 3; say
do k=0 to high % (max(1, j))
call tell_Ack j, k
end /*k*/
end /*j*/
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
tell_Ack: parse arg mm,nn; calls=0 /*display an echo message to terminal. */
#=right(nn,length(high))
say 'Ackermann('mm", "#')='right(ackermann(mm, nn), high),
left('', 12) 'calls='right(calls, high)
return
/*──────────────────────────────────────────────────────────────────────────────────────*/
ackermann: procedure expose calls /*compute value of Ackermann function. */
parse arg m,n; calls=calls+1
if m==0 then return n + 1
if n==0 then return ackermann(m-1, 1)
if m==2 then return n + 3 + n
return ackermann(m-1, ackermann(m, n-1) )

View file

@ -1,36 +0,0 @@
/*REXX program calculates and displays some values for the Ackermann function. */
numeric digits 100 /*use up to 100 decimal digit integers.*/
/*╔═════════════════════════════════════════════════════════════╗
When REXX raises a number to an integer power (via the **
operator, the power can be positive, zero, or negative).
Ackermann(5,1) is a bit impractical to calculate.
*/
high=24
do j=0 to 4; say
do k=0 to high % (max(1, j))
call tell_Ack j, k
if j==4 & k==2 then leave /*there's no sense in going overboard. */
end /*k*/
end /*j*/
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
tell_Ack: parse arg mm,nn; calls=0 /*display an echo message to terminal. */
#=right(nn,length(high))
say 'Ackermann('mm", "#')='right(ackermann(mm, nn), high),
left('', 12) 'calls='right(calls, high)
return
/*──────────────────────────────────────────────────────────────────────────────────────*/
ackermann: procedure expose calls /*compute value of Ackermann function. */
parse arg m,n; calls=calls+1
if m==0 then return n + 1
if m==1 then return n + 2
if m==2 then return n + 3 + n
if m==3 then return 2**(n+3) - 3
if m==4 then do; #=2 /* [↓] Ugh! ··· and still more ughs.*/
do (n+3)-1 /*This is where the heavy lifting is. */
#=2**#
end
return #-3
end
if n==0 then return ackermann(m-1, 1)
return ackermann(m-1, ackermann(m, n-1) )

View file

@ -1,15 +0,0 @@
let _m = Sys.argv[2]
let _n = Sys.argv[3]
let m = int_of_string(_m)
let n = int_of_string(_n)
let rec a = (m, n) =>
switch (m, n) {
| (0, n) => (n+1)
| (m, 0) => a(m-1, 1)
| (m, n) => a(m-1, a(m, n-1))
}
Js.log("ackermann(" ++ _m ++ ", " ++ _n ++ ") = "
++ string_of_int(a(m, n)))

View file

@ -1,20 +0,0 @@
option explicit
'~ dim depth
function ack(m, n)
'~ wscript.stdout.write depth & " "
if m = 0 then
'~ depth = depth + 1
ack = n + 1
'~ depth = depth - 1
elseif m > 0 and n = 0 then
'~ depth = depth + 1
ack = ack(m - 1, 1)
'~ depth = depth - 1
'~ elseif m > 0 and n > 0 then
else
'~ depth = depth + 1
ack = ack(m - 1, ack(m, n - 1))
'~ depth = depth - 1
end if
end function

View file

@ -1,5 +0,0 @@
wscript.echo ack( 1, 10 )
'~ depth = 0
wscript.echo ack( 2, 1 )
'~ depth = 0
wscript.echo ack( 4, 4 )