flatten function
prime numbers exercise