fork download
  1. require 'bigdecimal'
  2. require 'bigdecimal/util'
  3. def f(n)
  4. (2..n).each_with_object([4.to_r, "17/4".to_r]) {|n, a|
  5. a[n] = 108.to_r - (815.to_r) / a[n - 1] + 1500.to_r / (a[n - 1] * a[n - 2])
  6. }[n]
  7. end
  8. p [0, 1, 2, 3, 80].map {|n| [n, f(n), f(n).to_d(30)]}
  9.  
Success #stdin #stdout 0.01s 8268KB
stdin
Standard input is empty
stdout
[[0, (4/1), 0.4e1], [1, (17/4), 0.425e1], [2, (76/17), 0.447058823529411764705882352941e1], [3, (353/76), 0.464473684210526315789473684211e1], [80, (206795153138256918939565417139009598365577843034794672964/41359030627651383817474849310671104336332210648235594113), 0.499999999999999999642620179508e1]]