Remove collatz

This commit is contained in:
Angelos Chalaris
2020-04-16 10:57:20 +03:00
parent f2e55d7ea7
commit 68fd827bb0
2 changed files with 0 additions and 37 deletions

View File

@ -1,16 +0,0 @@
---
title: collatz
tags: math,beginner
---
Applies the Collatz algorithm.
If `n` is even, return `n/2`. Otherwise, return `3n+1`.
```js
const collatz = n => (n % 2 === 0 ? n / 2 : 3 * n + 1);
```
```js
collatz(8); // 4
```