Created xTotheN method and factorial method