added factorial. it seems to work on small numbers but is very slow