Skip to content
Snippets Groups Projects
Commit 4b876e81 authored by Michael Leuschel's avatar Michael Leuschel
Browse files

add Ackermann Notebook

parent 1433c77c
Branches
No related tags found
No related merge requests found
%% Cell type:markdown id:05d7c16f tags:
## Die Ackermann Funktion
%% Cell type:code id:dc177e49 tags:
``` prolog
ack(0,N,R) :- !, R is N+1.
ack(M1,0,R) :- !, M is M1-1, ack(M,1,R).
ack(M1,N1,R) :- M is M1-1, N is N1-1, ack(M1,N,R1),ack(M,R1,R).
```
%% Cell type:code id:4adf4ed2 tags:
``` prolog
?- ack(1,1,R).
```
%% Output
%% Cell type:code id:c26e7fa4 tags:
``` prolog
?- ack(1,2,R).
```
%% Output
%% Cell type:code id:d682c1fc tags:
``` prolog
?- ack(3,3,R).
```
%% Output
%% Cell type:code id:0e1603db tags:
``` prolog
?- ack(3,5,R).
```
%% Output
%% Cell type:code id:41d483da tags:
``` prolog
?- ack(3,6,R).
```
%% Output
%% Cell type:code id:19e3c25f tags:
``` prolog
?- ack(4,0,R).
```
%% Output
%% Cell type:code id:95f45975 tags:
``` prolog
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment