1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #!/usr/bin/ruby
- # Author: Daniel "Trizen" Șuteu
- # Date: 24 February 2018
- # https://github.com/trizen
- # A new formula for computing Viswanath's constant. (weak conjecture -- incorrect)
- # Blandin-Diaz compositional Bernoulli numbers (B^S)_1,n:
- # a(0) = 1
- # a(n) = -Sum_{k=0..n-1} a(k) / ((n-k+1)!)^2
- # Next, we define `t` to be the following sum:
- # t = Sum_{k=0..Infinity} 1 / (a(k) * k!)
- # From which we extract Viswanath's constant:
- # v = (19500 - 3*t)/(10756 - 3*t)
- # See also:
- # https://oeis.org/A078416
- # https://en.wikipedia.org/wiki/Random_Fibonacci_sequence
- # https://www.wolframalpha.com/input/?i=Viswanath%27s+constant
- # https://www.wolframalpha.com/input/?i=18497.440650652720515613516713415750667794722534171
- func a((0)) { 1 }
- func a(n) is cached {
- -sum(^n, {|k| a(k) / (n - k + 1)!**2 })
- }
- var t = sum(0..200, {|k|
- 1 / (a(k) * k!)
- })
- var v = (19500 - 3*t)/(10756 - 3*t)
- say "Viswanath's constant is: #{v} (conjectured)"
- __END__
- Viswanath's constant is: 1.13198824879430090510505642117075909739291590469 (conjectured)
|