Math fedi, help! I'm looking for a function that calculates the next prime given...

@arichtman@eigenmagic.net

Math fedi, help!

I'm looking for a function that calculates the next prime given a starting integer (not guaranteed prime) - i.e. what's the smallest prime larger than this number.

It looks like there are some functions for generating primes but nothing with a minimum and all the other articles are basically "loop and test each one" - maybe using a sieve function.

Does a nicer mathematic approach exist?

#Math #Mathematics #PrimeNumbers #Primes