I am trying to use two theorem environments, one for exercises and another for their solutions. The counter for the solution should be the same as the counter for the associated exercise.
An example:
Exercise 1.1. What is 2+2?
Exercise 1.2. What is 3+5?
Solution to Exercise 1.1. 2+2=4.
Solution to Exercise 1.2. 3+5=8.
Should be the output of:
\begin{exercise}\label{ex: 22} What is 2+2?\end{exercise}
\begin{exercise}\label{ex: 35} What is 3+5?\end{exercise}
\begin{solution}[ex: 22] 2+2=4.\end{solution}
\begin{solution}[ex: 35] 3+5=8.\end{solution}
Is this possible using the amsthm package?


amsthm, even if your question suggest otherwise, I recommend having a look atxsim, "exercise sheets improved" which can handle the task you want easily. – marc Nov 16 '23 at 11:36