31 , because a(n+1) = 2·a(n) + 1, with a(1) = 1
And the closed form is:
a(n) = 2ⁿ − 1
Check: 2¹−1 = 1, 2²−1 = 3, 2³−1 = 7, 2⁴−1 = 15, 2⁵−1 = 31.
Why they match: add 1 to both sides of your recurrence and you get a(n+1) + 1 = 2(a(n) + 1). So the shifted sequence a(n) + 1 just doubles each step — 2, 4, 8, 16, 32 — which is 2ⁿ. Subtract the 1 back and you have 2ⁿ − 1.
In binary these are 1, 11, 111, 1111, 11111 — each step appends another 1, which is exactly “double and add one.”