Find slightly better solution to problem 10 - end factor check if factor is found.