RosettaCodeData/Task/Bernoulli-numbers/00-TASK.txt
2023-07-01 13:44:08 -04:00

32 lines
2.2 KiB
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[[wp:Bernoulli number|Bernoulli numbers]] are used in some series expansions of several functions   (trigonometric, hyperbolic, gamma, etc.),   and are extremely important in number theory and analysis.
Note that there are two definitions of Bernoulli numbers;   this task will be using the modern usage   (as per   ''The National Institute of Standards and Technology convention'').
The &nbsp; n<sup>th</sup> &nbsp; Bernoulli number is expressed as &nbsp; '''B'''<sub>n</sub>.
<br>
;Task
:* &nbsp; show the Bernoulli numbers &nbsp; '''B'''<sub>0</sub> &nbsp; through &nbsp; '''B'''<sub>60</sub>.
:* &nbsp; suppress the output of values which are equal to zero. &nbsp; (Other than &nbsp; '''B'''<sub>1</sub>&nbsp;, all &nbsp; ''odd'' &nbsp; Bernoulli numbers have a value of zero.)
:* &nbsp; express the Bernoulli numbers as fractions &nbsp;(most are improper fractions).
:* &nbsp; the fractions should be reduced.
:* &nbsp; index each number in some way so that it can be discerned which Bernoulli number is being displayed.
:* &nbsp; align the solidi &nbsp; (<big><b>/</b></big>) &nbsp; if used &nbsp;(extra credit).
;An algorithm
The AkiyamaTanigawa algorithm for the "second Bernoulli numbers" as taken from [[wp:Bernoulli_number#Algorithmic_description|wikipedia]] is as follows:
'''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>)
;See also
* Sequence [[oeis:A027641|A027641 Numerator of Bernoulli number B_n]] on The On-Line Encyclopedia of Integer Sequences.
* Sequence [[oeis:A027642|A027642 Denominator of Bernoulli number B_n]] on The On-Line Encyclopedia of Integer Sequences.
* Entry [http://mathworld.wolfram.com/BernoulliNumber.html Bernoulli number] on The Eric Weisstein's World of Mathematics (TM).
* Luschny's [http://luschny.de/math/zeta/The-Bernoulli-Manifesto.html The Bernoulli Manifesto] for a discussion on &nbsp; <big> '''B<sub>1</sub> &nbsp; = &nbsp; -&frac12;''' &nbsp; versus &nbsp; '''+&frac12;'''. </big>
<br><br>