Possible Stacking Orders I have a question about how to calculate the total number of stacking combinations possible given a set of constraints.
Specifically, imagine I'm trying to make a linear stack of objects (specifically, a row of tiles in my bathroom). I have 3 colors A, B, C. I don't want to put A next to B. The smallest repeating unit I could make would then be:
ACBC
But say I want 5 tiles in my repeating unit, then I could make:
AACBC, ACBBC, or ACCBC
I don't consider ACBCC, as it is really the same pattern as ACCBC, but backwards.
Say I now have N tiles in my repeating unit. Is there a formulaic way to determine the number of ways to place them?
 A: The sequence appears in OEIS as A208716; however, neither a formula nor an asymptotic is given there, so I'll state a very general result (but only sketch the proof).  Suppose you have a bracelet with $n$ charms, and you want to color these with $m$ colors, but only certain colors may appear next to each other.  We capture the restrictions as a symmetric $m\times m$ matrix $M=(m_{ij})$, where
$$m_{ij}=\begin{cases}
  1,& \textrm{if colors $i$ and $j$ are allowed to be adjacent}\\
  0,& \textrm{otherwise.}
\end{cases}
$$
We'll call a string (or necklace or bracelet) legal if it satisfies these constraints.  We will call a color repeatable if it is allowed to be adjacent to itself.  The matrix $M$ in your example is
$$M=\pmatrix{1&0&1\\0&1&1\\1&1&1};$$
the fact that all colors are repeatable is reflected in the fact that the diagonal of $M$ consists of all $1$'s.
The key fact is Burnside's Lemma: if a finite group $G$ acts on a set $X$, the number of orbits is the average, over elements $g\in G$, of the number of fixed points of $g$:
$$|X/G| = \frac1{|G|}\sum_{g\in G} |{\rm Fix}(G)|.$$
For us, $X$ is the set of "legal" colorings, as determined by $M$, and $G$ is a group of symmetries: for "necklaces" $G$ is the $n$-element cyclic group which rotates the necklace, and for "bracelets" we also consider reflections (turning the bracelet upside down.)  (Bracelets are called "free necklaces" in this MathWorld article.) The orbits are just the equivalence classes of the jewelry under the relevant group action.
We start with necklaces: the number $N(n)$ of inequivalent legal necklaces of length $n$ is
$$N(n)=\frac1n\sum_{d|n}\phi(n/d)l(d),$$
where $\phi$ is the Euler phi-function and $l(d)$ is the number of legal necklaces of length $d$.  But the $(i,j)$ entry of $M^d$ is the number of legal strings of length $d+1$ which start at $i$ and end at $j$, so $l(d)$ is simply the trace of the matrix $M^d$.  In principle you can get a closed form for $l(d)$ by computing the Jordan form of $M$, but in some cases it's easier to note that the sequence $\{l(d)\}$ satisfies a linear recurrence equivalent to the characteristic polynomial of $M$.  (Note that if there are no adjacency restrictions, $M$ is the all-ones matrix, so $l(d)={\rm tr}M^d=m^d$ and the usual necklace formula falls out.)
For bracelets, $G$ also contains $n$ reflections. If $n$ is odd, all the reflections have a unique fixed point; if $n$ is even, then half the reflections have $2$ fixed points and the rest have none.  So the bracelet formulas are a little more complicated.  Here's the general result: if $B(n)$ denotes the number of inequivalent legal bracelets, then
$$B(n)= \frac12N(n)+\begin{cases}
  \frac12 s\left(\frac{n+1}2\right),& n{\rm\ odd}\\
  \frac14 p\left(\frac{n}2+1\right) + \frac14 b\left(\frac{n}2\right),& n {\rm\ even,}
\end{cases}
$$
where $p(n)$ is the number of legal strings of length $n$, $s(n)$ is the number of legal strings of length $n$ ending at a repeatable color, and $b(n)$ is the number of legal paths of length $n$ which both begin and end at a repeatable color.  (In your special case, $b(n)=s(n)=p(n)$ since all colors are repeatable.)  In any case, these are all easily expressible in terms of $M$: if $\bf j$ is a column vector of $1$'s, and if $\bf r$ is the column vector with $r_i=1$ iff color $i$ is repeatable, then
$$\begin{align}
  p(n)&={\bf j}^t M^{n-1} {\bf j}\\
  s(n)&={\bf j}^t M^{n-1} {\bf r}\\
  b(n)&={\bf r}^t M^{n-1} {\bf r}
\end{align}
$$
In particular, they satisfy the same recurrence as $l(n)$.
OK, specializing to your problem now: the characteristic polynomial of $M$ is
$z^3-3z^2+z+1,$ with roots $1$, $1+\sqrt2$ and $1-\sqrt2$.  We find
$$\begin{align}
  l(n)&=\left(1-\sqrt{2}\right)^n+\left(1+\sqrt{2}\right)^n+1\\
  p(n)=s(n)=b(n)&=\frac{1}{2}
   \left(\left(1-\sqrt{2}\right)^{n+1}+\left(1+\sqrt{2}\right)^{n+1}\right)
\end{align}
$$
Note $l(n)=3l(n-1)-l(n-2)-l(n-3).$
Plugging these into the formulas for $N(n)$ and $B(n)$ we can now count inequivalent legal bracelets:
$$\begin{array}{ccccccccccccccc}
 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 \\
 3 & 5 & 7 & 12 & 18 & 34 & 56 & 111 & 207 & 427 & 859 & 1851 & 3930 & 8672 & 19092
   \\
\end{array}
$$
Asymptotically, it is clear that the dominant term is the $d=n$ term in $N(n)$, so
$$B(n)\sim \frac{(1+\sqrt2)^n}{2n}$$
for large $n$.
Finally, it appears you may be anxious to use all three of your colors.  This count didn't require all the colors to be used, but you can use inclusion/exclusion to get the result in that case.  For any subset $S$ of the colors, let $B_S(n)$ denote the number of bracelets using only colors in $S$ (but not necessarily all of them.)  You can compute these by repeating the calculation with an appropriate submatrix of $M$.  Then the number of inequivalent bracelets using all three colors is:
$$N_{123}(n)-N_{12}(n)-N_{23}(n)-N_{13}(n)+N_1(n)+N_2(n)+N_3(n)-N_\emptyset(n).$$
