Just a thought...
This reminds me of the Factorial function. The same values will always be returned. With that in mind, it would probably be the best to store the inputs and the results in an NVP table and simply query the table for results. It's not like the list of Prime Numbers is going to change any time soon and, like a Tally Table, won't take very much room. If the system must remain "readless", then that may be another story but I can't imagine why a system would need to remain "readless".
So use Jonathan 's good function to generate such a table.
is pronounced "ree-bar
" and is a "Modenism
" for R
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
"If you think its expensive to hire a professional to do the job, wait until you hire an amateur."--Red Adair
"Change is inevitable... change for the better is not."
When you put the right degree of spin on it, the number 3|8
is also a glyph that describes the nature of a DBAs job. 😉
How to post code problems