add lila source example files

This commit is contained in:
Romain Paquet 2023-10-16 22:36:33 +02:00
parent 86d4f7fffb
commit 374daaff7f
8 changed files with 49 additions and 0 deletions

13
examples/syracuse.lila Normal file
View file

@ -0,0 +1,13 @@
// Computes the syracuse sequence with the given inital term
// until it reaches 1 (it probably will).
fn syracuse(x0: int) int {
x = x0;
while x != 1 {
if x % 2 == 0 {
set x = x / 2;
} else {
set x = 3 * x + 1;
};
};
x
}