https://github.com/102/sudan
hacktoberfest
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/102/sudan
- Owner: 102
- License: mit
- Created: 2020-05-10T12:52:13.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2025-08-12T14:06:07.000Z (12 months ago)
- Last Synced: 2025-09-26T11:46:03.698Z (10 months ago)
- Topics: hacktoberfest
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sudan
The [Sudan function][2]. In the theory of computation, the Sudan function is an example of a function that is recursive, but not primitive recursive. This is also true of the better-known Ackermann function. The Sudan function was the first function having this property to be published.
It was discovered (and published) in 1927 by [Gabriel Sudan][1], a Romanian mathematician who was a student of David Hilbert.
## Definition
```math
\begin{array}{lll} \\
F_0(x, y) & = x+y \\
F_{n+1}(x,0) & = x & \text{if }n \geq 0 \\
F_{n+1}(x,y+1) & = F_n(F_{n+1}(x,y),F_{n+1}(x,y)+y+1 & \text{if }n \geq 0
\end{array}
```
## Usage
```js
const F = require("sudan");
console.log(F(1n, 4n, 7n)); // => 759n
```
[1]: https://en.wikipedia.org/wiki/Gabriel_Sudan
[2]: https://en.wikipedia.org/wiki/Sudan_function