Check if a number is prime and find its prime factors. Also generates a list of prime numbers up to any value using the Sieve of Eratosthenes.