version 2 of prime number dynamically calculate