---
# System prepended metadata

title: Untitled

---

A function (fn1) takes an input of numbers (of binary number string) and replaces each 1 with 01 and each 0 with 10.

```golang
func fn1(binary string) string {
  result := ""
  for i := 0; i < len(binary); i += 1 {
    if binary[i] == '0' {
      result += "10"
    } else if binary[i] == '1' {
      result += "01"
    }
  }
  return result
}

// fn1(1) = 01
// fn1(01) = 1001
// fn(1001) = 01101001
```

function fn2 calls fn1 n times starting with 1
```golang
func fn2(n int) string {
  s := "1"
  for i := 0; i < n; i += 1 {
    s = fn1(s)
  }
   return s
} 

// fn2(1) = 01
// fn2(2) = 1001
// fn2(3) = 01101001
```

find the number of consecutive zeroes that will be returned on calling fn2 with an integer n.

```haskell
f(1)  = 0     -- fn2(1) = 01
f(2)  = 1     -- fn2(2) = 1001
f(3)  = 1     -- fn2(3) = 01101001
f(4)  = 3     -- fn2(4) = 1001011001101001
f(10) = 171   -- fn2(10) = 1001011001101001011010011001011001101001100101101001011001101001011010011001011010010110011010011001011001101001011010011001011001101001100101101001011001101001100101100110100101101001100101101001011001101001011010011001011001101001100101101001011001101001011010011001011010010110011010011001011001101001011010011001011010010110011010010110100110010110011010011001011010010110011010011001011001101001011010011001011001101001100101101001011001101001011010011001011010010110011010011001011001101001011010011001011001101001100101101001011001101001100101100110100101101001100101101001011001101001011010011001011001101001100101101001011001101001100101100110100101101001100101100110100110010110100101100110100101101001100101101001011001101001100101100110100101101001100101101001011001101001011010011001011001101001100101101001011001101001011010011001011010010110011010011001011001101001011010011001011001101001100101101001011001101001100101100110100101101001100101101001011001101001011010011001011001101001100101101001011001101001
f(16) = 10923 -- fn2(16) is 65536 characters
```