factorial and some tests