# is there any good way to figure out number of fourier series frequencies of some signal?

Suppose you have $f(t)$, but you do not know the exact function and can only measure $f(t)$ at certain time. Assume $f(t)$ is complex-valued with $t$ being "time."

One wishes to find out the number of distinct Fourier series frequencies in $f(t)$. That is, finding out the number of frequencies with $B_{\omega} \neq 0$ for $f(t) = \sum_{\omega}B_{\omega}e^{i\omega t}$ where $B_{\omega}$ refers to amplitude at angular frequency $\omega$.

Is there any good way to figure this out? Or do we have to use Nyquist sampling conditions and do discrete fourier transform?

You are always stuck to the Nyquist theorem, which means that you cannot directly measure the amplitude $B_\omega$ at a specific angular frequency $\omega$, but will always evaluate $B_{\omega,\textrm{meas}} = \sum_{i = 0}^{\infty}B_{\omega+i \omega_s}$, where $\omega_s$ denotes the angular frequency of your sampling process.
This theorem is independent of the algorithm evaluating $B_\omega$.
Usually one lowpass filters the signal before sampling to ensure there is no signal for $i>0$. But of course you can also bandpass filter at a higher frequency to only measure a signal for some $i>0$. Then you will sample the alias of your real signal. Example: Considering you want to analyse the spectrum from $\omega_0 = 2\pi\, 100\, \mathrm{M} \mathrm{rad}^{-1}$ to $\omega_1 = 2\pi\, 101\, \mathrm{M} \mathrm{rad}^{-1}$ you could sample with $\omega_s = 2\pi\, 2\,\mathrm{M} \mathrm{rad}^{-1}$ and you would get signal for $B_\omega$ with $\omega \leq 2\pi\, 1\, \mathrm{M} \mathrm{rad}^{-1}$ (assuming the analogue parts of your hardware are capable of handling $\omega_1$).
(In real world, as the bandpass filter has to filter from $\omega_0 = 2\pi\, 100\, \mathrm{M} \mathrm{rad}^{-1}$ to $\omega_1 = 2\pi\, 101\, \mathrm{M} \mathrm{rad}^{-1}$, you would have to use a slight higher sampling rate as $\omega_s = 2\pi\, 2\,\mathrm{M} \mathrm{rad}^{-1}$, as there is no perfect rectangular bandpass filter.)