That's a very general question, so you get a very general answer:
the experimental design + the distributional assumption about the response, which together define the statistical model
if the distributional model of the response variable has a free nuisance parameter, you need a guess or estimate for this parameter
the hypothesis within this model you like to test, particularly the difference between the null and the alternative hypothesis
the level of significance you like to accept ("alpha")
the minimum power ("1-beta") you want to have to reject the null hypothesis when the difference between the truth and the null is at least as large as the difference between the chosen alternative and the null
If there is an equation to get the sample size depends on your experimental design or the concrete statistical model. It may be that you have to run simulations to find the sample size.
The sample size basically will depend on the parameter minimal variation that you want significantly statistically assess and on the power that you want associate to the test used. An equation exists to do this, you can google "matlab sampsizepwr" for more information.
As far as sample size is concerned, there is a very popular formula developed by Krejcie and Morgan in 1970.
Article Determining Sample Size for Research Activities
Based on this formula, a table has been generated that can be used to identify the ideal sample size that one must choose in case they know the size of the universe.
You can find the table here. https://www.kenpro.org/sample-size-determination-using-krejcie-and-morgan-table/
Krejcie, R. V., & Morgan, D. W. (1970). Determining sample size for research activities. Educational and psychological measurement, 30(3), 607-610.
G*Power is still available, and free. You need preliminary data to estimate some values. However, playing with G*Power and associated documentation will help you learn what you need to get from preliminary data. However, the quality of your estimated sample size is dependent on the quality of your preliminary data.