Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-rosetta/blob/main/drafts/rosettacode/ackermann-function.wiki # omega-rosetta aien-dev/omega-rosetta Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-rosetta / drafts / rosettacode / ackermann-function.wiki` 83 lines ยท 1414 bytes Raw Blame History 1 =={{header|Omegese}}== 2 {{works with|omc|sha256 `2c824805`, aien-dev/omega-mv `e5b32567`, Linux AArch64}} 3 Omega has no imports, so the small output helpers (emit and friends) are part of the program. 4 5 om2 6 text nl "\n" 7 text pre "A(" 8 text cm ", " 9 text post ") = " 10 note emit writes every byte of a to stdout; a short write is retried, an error exits 1 11 fn emit a view uchar * to void 12 o = ulong 0 13 while lt o len a bound 4096 14 k = write 1 a o sub len a o 15 if le k 0 16 exit 1 17 end 18 o = add o ulong k 19 end 20 end 21 note emitu writes n in decimal; 20 digits hold every ulong 22 fn emitu n ulong to void 23 d = new uchar 20 0 24 i = ulong 20 25 v = n 26 while true bound 20 27 i = sub i 1 28 put d i uchar add rem v 10 48 29 v = div v 10 30 if eq v 0 31 break 32 end 33 end 34 emit part d i sub 20 i 35 end 36 note recursive, as the task asks; program mode allows recursion, the 8 MiB stack bounds its depth 37 fn ack m ulong n ulong to ulong 38 if eq m 0 39 ret add n 1 40 end 41 if eq n 0 42 ret ack sub m 1 1 43 end 44 ret ack sub m 1 ack m sub n 1 45 end 46 fn main to int 47 for m ulong 4 48 for n ulong 5 49 emit pre 50 emitu m 51 emit cm 52 emitu n 53 emit post 54 emitu ack m n 55 emit nl 56 end 57 end 58 ret 0 59 end 60 61 {{out}} 62

63 A(0, 0) = 1

64 A(0, 1) = 2

65 A(0, 2) = 3

66 A(0, 3) = 4

67 A(0, 4) = 5

68 A(1, 0) = 2

69 A(1, 1) = 3

70 A(1, 2) = 4

71 A(1, 3) = 5

72 A(1, 4) = 6

73 A(2, 0) = 3

74 A(2, 1) = 5

75 A(2, 2) = 7

76 A(2, 3) = 9

77 A(2, 4) = 11

78 A(3, 0) = 5

79 A(3, 1) = 13

80 A(3, 2) = 29

81 A(3, 3) = 61

82 A(3, 4) = 125

83