Anonymous user
Bernoulli numbers: Difference between revisions
Add an algorithm.
(→{{header|Python}}: Improved output routine.) |
(Add an algorithm.) |
||
Line 17:
(Other than '''B'''<sub>1</sub>, all odd Bernoulli have a value of 0 (zero).
;An algorithm:
'''see also'''▼
The numbers can be computed with the following algorithm (from [[wp:Bernoulli_number#Algorithmic_description|wikipedia]])
'''for''' ''m'' '''from''' 0 '''by''' 1 '''to''' ''n'' '''do'''
''A''[''m''] ← 1/(''m''+1)
'''for''' ''j'' '''from''' ''m'' '''by''' -1 '''to''' 1 '''do'''
''A''[''j''-1] ← ''j''×(''A''[''j''-1] - ''A''[''j''])
'''return''' ''A''[0] (which is ''B''<sub>''n''</sub>)
* Sequence [http://oeis.org/A027641 A027641 Numerator of Bernoulli number B_n] on The On-Line Encyclopedia of Integer Sequences.
* Sequence [http://oeis.org/A027642 A027642 Denominator of Bernoulli number B_n] on The On-Line Encyclopedia of Integer Sequences.
|