diff --git a/arithmetics.ts b/arithmetics.ts index 6197973..6fe4aca 100644 --- a/arithmetics.ts +++ b/arithmetics.ts @@ -30,4 +30,22 @@ type Fib = N extends _0 ? N : Add>, Fib>>; +type Factorial = N extends _0 + ? _1 + : Multiply>> + +type Modulo = B extends _0 + ? _0 + : ModHelper, B> + +type ModHelper = Sub extends _0 + ? A extends B + ? Modulo + : A + : Modulo + +type IsEven = Modulo extends _0 + ? true + : false + type Result = Add<_2, _2>;