diff --git a/src/multiplication.c b/src/multiplication.c index a162d6b..201093f 100644 --- a/src/multiplication.c +++ b/src/multiplication.c @@ -96,5 +96,10 @@ int multiply_using_modulo(int num1, int num2, int modulo) { return (num1 % modulo) * (num2 % modulo) % modulo; } +int multiply_by_prime(int num, int prime) { + return num * (prime - 1) + num; +} + + diff --git a/src/multiplication.h b/src/multiplication.h index a0d92dd..26da04e 100644 --- a/src/multiplication.h +++ b/src/multiplication.h @@ -15,6 +15,7 @@ int multiply_by_even(int num, int factor); int multiply_using_lookup_table(int num1, int num2); int multiply_using_logical_operations(int num1, int num2); int multiply_using_modulo(int num1, int num2, int modulo); +int multiply_by_prime(int num, int prime); #endif // MULTIPLICATION_H