Attaching $2$-cell to a circle I get this problem from my past Qual.
" For $n=1,2,\dots$ let $f_n\colon S^1\to S^1$ be the map $z\mapsto
  z^n$. Define $$X(n)=S^1\cup_{f_n} e^2$$ as the cell complex obtained
  by attaching a 2-cell to the circle via the attaching map $f_n$. Similarly, for
  $m,n=1,2,\dots$ define $$X(m,n)=S^1\cup_{f_m}
  e^2_1\cup_{f_n}e^2_2$$ as the cell complex obtained from the circle
  by attaching two 2-cells, with attaching maps $f_m$ and $f_n$.
a) Show that if $m>n$ then the maps
    $$f_m,f_{m-n}\colon S^1\to S^1\hookrightarrow X(n)$$
    are homotopic as maps into $X(n)$.
b) Show that for all $m,n$ the space $X(m,n)$ is homotopy
      equivalent to the wedge sum $S^2\vee X(k)$ for a certain
      $k=k(m,n)$. Give an explicit formula for $k$ in terms of $m,n$."
For $(a)$, I consider the homotopy $H\colon S^1\times I \to S^1$ where $H(z,t)=z^{m-nt}$. This is clearly continuous. Hence the homotopy $S^1\times I \to S^1 \to X(n)$ is our desired homotopy. So we're done.
The problem is, I don't even care about $X(n)$, so it must be wrong somewhere. Can you help me with this?
I have no clue how to do $(b)$ since I cannot visualize $X(n),$ let alone $X(m,n)$.
 A: I think this is a good Algebraic Topology question, because if you approach it a certain way then the algebra does a lot of the heavy lifting but there are still one or two crucial topological inputs.
Hint for a):
Use Seifert-van Kampen to compute $\pi_1(X(n))$, and in particular see that $f_1$ is a generator. Notice that $f_m = f_1^m \sim *^m f_1$ (where $*$ is path concatenation in $\pi_1$).
Hint for b):
As a warm-up first prove the following two equivalences: $X(n,n)$ is homotopy equivalent to $X(n,0)$ (where $f_0$ is the constant map) and $X(n,0)$ is homeomorphic to $X(n) \vee S^2$. For $n< m$ consider part a) and the Euclidean algorithm.

More thorough hints for b):
Instead of directly writing down an explicit homotopy equivalence between $X(n,m)$ and $X(k)\vee S^2$ we can use the following key observation, which is the main topological input: if $f_m,f_{m'}\colon S^1 \to S^1 \hookrightarrow X(n)$ are homotopic then $X(n, m)$ is homotopy equivalent to $X(n,m')$ (see for example this question). This fact together with part a) implies that if $n < m$ then $X(n, m)\simeq X(n, m-n)$. Run the Euclidean algorithm on $n$ and $m$.
Observe that we could a priori determine what $k$ would have to be by assuming the homotopy equivalence in part b) is true and computing $\pi_1(X(n,m))$. Applying van Kampen to $X(n) \cup_{f_m} e^2$ we find $\pi_1(X(n, m))$ is again generated by $f_1$, but we are now given two relations: $n[f_1] = 0$ and $m[f_1] = 0$. We still know the group is cyclic and has torsion, so it must be isomorphic to $\mathbb{Z}/k$ for some $k$: determine $k$, with the help of the Euclidean algorithm. 
