factorial using array