Adding factorial function.

Modifying struct functions as well.
Signed-off-by: Hela <hnciri@baylibre.com>
Signed-off-by: Jerome Loisel <jeromeloiselmaurin@gmail.com>