Data update

This commit is contained in:
Ingy döt Net 2025-08-11 18:05:26 -07:00
parent 4d5544505c
commit 4924dd0264
3073 changed files with 55820 additions and 4408 deletions

View file

@ -0,0 +1,22 @@
CREATE OR REPLACE FUNCTION combinations(n, k) as table (
WITH RECURSIVE cte(current, remaining) AS (
-- start with empty combination and the full list
SELECT
[],
range(1, n + 1)
UNION ALL
-- recursive case: add one item to the current combination
SELECT
current || remaining[j:j],
remaining[j+1:]
FROM cte, range(1, length(remaining)+1) _(j)
WHERE length(current) < k
)
SELECT current AS combination
FROM cte
WHERE length(current) = k
);
## Example:
FROM combinations(5,3)
ORDER BY combination;