You are viewing a single comment's thread. Return to all comments →
MySQL (not the best way)
with recursive cte as ( select 31 as n, cast('2&3&5&7&11&13&17&19&23&29&31' as char(600)) as t union select n+1, if( (n+1)%2>0 and (n+1)%3>0 and (n+1)%5>0 and (n+1)%7>0 and (n+1)%11>0 and (n+1)%13>0 and (n+1)%17>0 and (n+1)%19>0 and (n+1)%23>0 and (n+1)%29>0 and (n+1)%31>0, concat(t,'&', n+1), concat(t,'')) from cte where n<1000) select t from cte where n=1000;
Seems like cookies are disabled on this browser, please enable them to open this website
Print Prime Numbers
You are viewing a single comment's thread. Return to all comments →
MySQL (not the best way)