REDUCE

7.4 Bernoulli, Euler and Fibonacci Numbers

Bernoulli numbers are provided by the unary operator Bernoulli. If n is a non-negative integer, the call Bernoulli(n) evaluates to the nth Bernoulli number; all of the odd Bernoulli numbers, except Bernoulli(1), are zero. Otherwise the result involves the original operator bernoulli; on graphical interfaces this is rendered as Bn.

Euler numbers are computed by the unary operator Euler. If n is a non-negative integer, the call Euler(n) returns the nth Euler number; all of the odd Euler numbers are zero. Otherwise the result returned involves the original operator euler; on graphical interfaces this is rendered as En.

Fibonacci numbers are provided by the unary operator Fibonacci, where Fibonacci(n) evaluates to the nth Fibonacci number; if n is an integer, this will be evaluated following the recursive definition:

F0 = 0;    F1 = 1;     Fn = Fn−1 + Fn−2.
The recursion is, of course, optimised as a simple loop to avoid repeated computation of lower-order numbers. Otherwise the result returned involves the original operator fibonacci; on graphical interfaces this is rendered as Fn.