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,11 @@
create or replace function fib_to(n) as table (
with recursive fib(e,f) as (
select 1, 1
union all
select e+f,e from fib
where e <= n)
select f from fib
order by f
);
from fib_to(55);

View file

@ -0,0 +1,2 @@
select round ( power( ( 1 + sqrt( 5 ) ) / 2, level ) / sqrt( 5 ) ) fib
from range(1,11) t(level);

View file

@ -0,0 +1 @@
SELECT 0::UHUGEINT, 1::UHUGEINT

View file

@ -0,0 +1,16 @@
# Warning: the following program has been naively adapted from the PostgresQL but
# should be further modified to ensure correctness, e.g. by adding a counter
CREATE or replace FUNCTION fib(n) AS (
WITH RECURSIVE fibonacci(current, previous) AS (
SELECT 0::UHUGEINT, 1::UHUGEINT
-- another possibility: SELECT 0::FLOAT, 1::FLOAT
UNION ALL
SELECT previous + current, current FROM fibonacci
)
SELECT current FROM fibonacci
LIMIT 1 OFFSET n
);
# Example
select fib(100);