Function bernoulli #
Return the nth Bernoulli number, for positive integers n
Syntax #
math.bernoulli(n)
Parameters #
| Parameter | Type | Description |
|---|---|---|
n |
number | BigNumber | bigint | Fraction | Index of the Bernoulli number |
Returns #
| Type | Description |
|---|---|
| number | BigNumber | Fraction | nth Bernoulli number, of a type corresponding to the argument n |
Throws #
Type | Description —- | ———–
Examples #
math.bernoulli(1) // returns -0.5
// All other odd Bernoulli numbers are 0:
math.bernoulli(7) // returns 0
math.bernoulli(math.bignumber(6)) // value bignumber(1).div(42)
// Produces exact rationals for bigint or fraction input:
math.bernoulli(8n) // Fraction -1,30
math.bernoulli(math.fraction(10)) // Fraction 5,66