add collatz conjecture

This commit is contained in:
Malin Freeborn 2025-02-11 21:16:49 +01:00
parent ef7b424586
commit 02381c71f2
Signed by: andonome
GPG Key ID: 52295D2377F4D70F

View File

@ -6,7 +6,20 @@ tags: [ "fun" ]
- `asciiquarium`
- `cbonsai -lim "$(fortune)"`
```bash
```sh
cow=$(cowsay -l | sort -R | head -1)
fortune -s | figlet | cowsay -nf $cow | lolcat
```
Watch the [Collatz Conjecture](https://en.wikipedia.org/wiki/Collatz_conjecture) collapse:
```sh
x="$(du -sc ~/.cache | tr -d '[:alpha:]' | tail -1)"
until [ "$x" -eq "1" ]; do
test "$(( x % 2 ))" -eq 0 && x=$(( x / 2 )) || \
x=$(( x * 3 + 1 ))
clear -x
figlet "$x" | lolcat
sleep 1
done
```