Debian Codegraph @

examples/prism-gap.html

raw symbols SCIP
1 <h2>Full example</h2>
2 <pre><code># Source: https://www.gap-system.org/Manuals/doc/ref/chap4.html#X815F71EA7BC0EB6F
3 gap> fib := function ( n )
4 > local f1, f2, f3, i;
5 > f1 := 1; f2 := 1;
6 > for i in [3..n] do
7 > f3 := f1 + f2;
8 > f1 := f2;
9 > f2 := f3;
10 > od;
11 > return f2;
12 > end;;
13 gap> List( [1..10], fib );
14 [ 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 ]
15 </code></pre>