Skip to content

Instantly share code, notes, and snippets.

@Goryudyuma
Created February 28, 2018 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Goryudyuma/1d0b975d4a2daf628e2923c05c63de8e to your computer and use it in GitHub Desktop.
Save Goryudyuma/1d0b975d4a2daf628e2923c05c63de8e to your computer and use it in GitHub Desktop.
MISQUERY ONLINE
SELECT n
FROM (
(WITH RECURSIVE numbers (x) AS (
SELECT 2
UNION ALL
SELECT x + 1 FROM numbers WHERE x <= 10000)
SELECT tbl.n, COUNT(tbl.n)
FROM numbers AS n
INNER JOIN tbl
ON MOD(tbl.n, x) = 0
GROUP BY tbl.n)
) AS ans
WHERE ans.count = 1
ORDER BY ans.n;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment