(*  bernoulli_number_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the Bernoulli numbers *)
(*    at selected index values fn(n), *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  02 December 2005 *)
(*  Author:  John Burkardt *)

nvec = {};
fvec = {};
num = 0;

Do [ { 
f = BernoulliB[n];
num = num + 1;
nvec = Append[nvec, n];
fvec = Append[fvec, f];
Print["  B[", n, "]=", N[f,16]] },
{n,0,20,1}]

n = 30;
f = BernoulliB[n];
num = num + 1;
nvec = Append[nvec, n];
fvec = Append[fvec, f];
Print["  B[", n, "]=", N[f,16]]

fileout=OpenWrite["/Users/burkardt/public_html/math_src/test_values/bernoulli_number_values.txt"];
SetOptions[fileout,FormatType->TextForm];
Write[fileout,"#  bernoulli_number_values.txt"];today=DateList[];Write[fileout,"#  Created on ",today];Write[fileout,"#"];
Write[fileout,"#  n  fn"];
Write[fileout,"#"];
Do[{n=nvec[[i]];fn=fvec[[i]];Write[fileout,N[n,16],"  ",N[fn,16]]},{i,1,num,1}]Close[fileout];;