OFFSET
0,1
COMMENTS
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.
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.
LINKS
S. Findley, Viswanath's curve
FORMULA
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.
EXAMPLE
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.
PROG
(Visual Basic)
'Visual Basic .NET
Private Structure VISINFO
Public dec, str, terms As String
End Structure
Private Function InputDecimal(ByVal vConstant As String) As VISINFO
On Error Resume Next
Dim i, q As Int32, a, b, c, n, z, v, sum As Decimal, gBit As String
gBit = "" : a = 0 : b = 1 : c = 0 : n = CDec(CDec(vConstant) ^ 3) : z = n
InputDecimal.dec = "" : InputDecimal.terms = "" : InputDecimal.str = ""
For i = 1 To CInt(txtExponent.Text)
If Abs(Abs(a + b) - n) < Abs(Abs(a - b) - n) Then
c = a + b : gBit = "1"
Else
c = a - b : gBit = "0"
End If
a = b : b = c
v = CDec(System.Math.Abs(c) ^ (1 / i))
sum += v : q += 1
InputDecimal.terms &= gBit & " " & CStr(i) & " " & CStr(System.Math.Round(n)) & " " & c.ToString & vbCrLf
InputDecimal.str &= gBit
InputDecimal.dec = ((sum / q) ^ (1 / 3)).ToString
n = n * z
Next
End Function
CROSSREFS
KEYWORD
easy,nonn,uned
AUTHOR
Shane Findley, Feb 19 2008
STATUS
approved