0

I am working on this problem: We define $S_N$ be all possible combination of the binary number the have following characteristic:
-if $n=1$, $S_1=1$, and for $n \geq 2$ start all with '01'
-the numbers have $n$ digits
-the numbers are never composed by three consecutive numbers (ex 0111)

I tried different approaches, but i notice that $S_N=2S_{N-1}-S_{N-2}$ and gives Fibonacci numbers. The idea is start with $S_{N-1}$, if we want building $S_{N}$ we must put 1 and 0 for every $S_{n-1}$ (so $2S_{N-1}$) but after we must not consider that strings composed by three consecutive numbers, and it's magically $S_{n-2}$ but i am unable to prove it.

1 Answers1

0

I have previously described in detail a general solution for every sequence of the form $f_n=af_{n-1}+bf_{n-2}$ with arbitrary $f_0,f_1$. The solution can be expressed as

$$ f_n=\left(f_1-\frac{af_0}{2}\right) \frac{\alpha^n-\beta^n}{\alpha-\beta}+\frac{f_0}{2} (\alpha^n+\beta^n) $$

where $\alpha,\beta=(a\pm\sqrt{a^2+4b})/2$.

Specializing to your problem, $S_N=2S_{N-1}-S_{N-2}$ we see that $a,b=2,-1$ so that $\alpha=\beta=a/2=1$. In that case, we need to use the identity

$$ \frac{\alpha^n-\beta^n}{\alpha-\beta}=\alpha^{n-1}\beta^0+\alpha^{n-1}\beta^1+\alpha^{n-3}\beta^2+...+\alpha^{0}\beta^{n-1} $$

which in your case reduces to $\frac{\alpha^n-\beta^n}{\alpha-\beta}=N$.

And finally, your solution is

$$S_N=\bigg(S_1-S_0\bigg)N+S_0$$

This solution is in agreement with Greg Martin's comment and has been verified by numerical comparison with the recurrence relation for random $\pm\ S_0 \text{ and } S_1$.

Cye Waldman
  • 8,196
  • Assuming OP's recurrence is correct, there's a more direct solution. You could also write $a_N=S_N-S_{N-1}$ and then you have $a_N=a_{N_1}=\dots=a_1$. Thus, $S_N = Na_0 + S_0=N(S_1-S_0)+S_0$. – Stefan Lafon Sep 11 '23 at 03:53
  • @StefanLafon That's true. But my process, though more lengthy, will work on any such recurrence. But, alas, your ad hoc solution is sweet. – Cye Waldman Sep 11 '23 at 04:59
  • I like the general solution that you have found. – Stefan Lafon Sep 11 '23 at 17:01