so_damn_insane's Journal
[Most Recent Entries]
[Calendar View]
[Friends View]
Tuesday, November 4th, 2008
Time |
Event |
12:09p |
(c) FJE jaunogre, ogre, pārogre
new-ouger, ouger, uber-ouger/over-ouger | 5:30p |
fibonači skaitļu ģenerēšana SQL Var izmantot arī Pī aprēķināšanai utml.
create type t_array as table of number;
create or replace function fibonaci(p in number) return t_array PIPELINED as v_n number := 1; v_n1 number := 1; v_current number; begin for i in 1 .. p loop if i in (1,2) then pipe row(1); else v_current := v_n + v_n1; v_n := v_n1; v_n1 := v_current; pipe row(v_current); end loop; return; end; /
select * from table(fibonaci(10)); | 5:51p |
Trivia Uz ko tiecas Fibonači(n)/Fibonači(n-1), kad n tiecas uz +bezgalību? ( ... tālāk ... ) |
|