zahl

Log | Files | Refs | README

commit ec1be97d7b8e1a65ba6215c7e75d8c3bc42d9fb2
parent 8b3d2da6ce853b855d4dbc872547ef1fea75160d
Author: Thomas Vigouroux <thomas.vigouroux@univ-grenoble-alpes.fr>
Date:   Fri, 14 Jun 2024 13:43:23 +0200

perf: add syracuse length

Diffstat:
Mbenchmarks/syracuse.scm | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/benchmarks/syracuse.scm b/benchmarks/syracuse.scm @@ -5,3 +5,7 @@ (if (= (% n 2) 0) (syracuse (/ n 2)) (syracuse (+ (* 3 n) 1)))))) + +(defn! syracuse-len (n) + (if (= n 1) 1 + (+ 1 (syracuse-len (if (even? n) (/ n 2) (fma 3 n 1))))))