As a sidenote, the mathtools package, which makes some improvements on amsmath, provides a way of labeling only those equations that are referenced in the text.

\documentclass{article}
\usepackage{mathtools}
\mathtoolsset{showonlyrefs}
\begin{document}
\begin{gather}
a = b \label{eq1} \\
c = d \label{eq2}
\end{gather}
Some text, \eqref{eq2}.
\end{document}
In this case, only the second of the equations, c = d, is numbered, as that is the only one being referenced in the text.
Notes
- three compiler passes are required for the references to show up properly
- this does not work with
cleveref, but the cleveref manual mentions another package, autonum, that performs the same task, yet is compatible with cleveref.
- the manual of the present version (dated 2012/05/10) notes two bugs, one can cause that the number is printed close to, or on top of, the equation, the other relates to
ntheorem. Refer to the manual for details.
equation → equation*,equation* → equation. See also [math mode - What are the differences between $$, \, align, equation and displaymath? - TeX - LaTeX Stack Exchange – user202729 May 31 '23 at 13:12