12345678910111213141516 |
- #!/usr/bin/ruby
- #
- ## https://rosettacode.org/wiki/Hickerson_series_of_almost_integers
- #
- func h(n) {
- n! / (2 * pow(2.log, n+1));
- }
-
- for n in (1..17) {
- var hn = h(n).roundf(-3);
- "h(%2d) = %22s is%s almost an integer.\n".printf(
- n, hn, hn.to_s ~~ /\.[09]/ ? '' : ' NOT');
- }
|