%I #8 Mar 08 2020 22:40:18
%S 0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,
%T 0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,
%U 1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0
%N Generating function for Viswanath's constant, using the golden string.
%C For each bit of the golden string that is a 1, write seven consecutive bits and for each 0 of the golden string write eight consecutive bits.
%C Alternate between 0 and 1. Exclude the first seven bits since we are based at zero, just like the golden string. Heads = 1, Tails = 0.
%H S. Findley, <a href="http://groups.myspace.com/ViswanathsCurve">Viswanath's curve</a>
%F Each power of Viswanath's constant (1.131988248...) And V^3 has a corresponding coin flip. Simply take the absolute values of the two possible(+Heads or -Tails) outcomes and choose the flip closest to the value of the power.
%e Bit 1 of the golden string is a 1, so bits 8-14(seven consecutive) are the same. Bit 2 of the golden string is 0, so bits 15-22(eight consecutive) are the same. Odd bits of the golden string mean to write 1 and even bits of the golden string mean to write 0.
%o 'Visual Basic .NET
%o Private Structure VISINFO
%o Public dec, str, terms As String
%o End Structure
%o Private Function InputDecimal(ByVal vConstant As String) As VISINFO
%o On Error Resume Next
%o Dim i, q As Int32, a, b, c, n, z, v, sum As Decimal, gBit As String
%o gBit = "" : a = 0 : b = 1 : c = 0 : n = CDec(CDec(vConstant) ^ 3) : z = n
%o InputDecimal.dec = "" : InputDecimal.terms = "" : InputDecimal.str = ""
%o For i = 1 To CInt(txtExponent.Text)
%o If Abs(Abs(a + b) - n) < Abs(Abs(a - b) - n) Then
%o c = a + b : gBit = "1"
%o Else
%o c = a - b : gBit = "0"
%o End If
%o a = b : b = c
%o v = CDec(System.Math.Abs(c) ^ (1 / i))
%o sum += v : q += 1
%o InputDecimal.terms &= gBit & " " & CStr(i) & " " & CStr(System.Math.Round(n)) & " " & c.ToString & vbCrLf
%o InputDecimal.str &= gBit
%o InputDecimal.dec = ((sum / q) ^ (1 / 3)).ToString
%o n = n * z
%o Next
%o End Function
%Y Cf. A036299, A078416, A115064.
%K easy,nonn,uned
%O 0,1
%A _Shane Findley_, Feb 19 2008
|