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,16 @@
create or replace function pascal_triangle(n) as table (
with recursive cte as (
SELECT 0 as i, [1]::BIGINT[] as row,
UNION ALL
SELECT i+1 as i,
([1] || list_transform(row, (x,ix) -> x + (coalesce(row[ix+1], 0)))) as row
FROM cte
WHERE i < n
)
select row as "pascal_triangle" FROM cte
order by i
);
.print The results for all n<=0 are the same:
select * as "pascal_triangle(0)" from pascal_triangle(0);
from pascal_triangle(4) _("pascal_triangle(4)");