I'm just a normal "civilian" here, but a little while ago I was playing around with some numbers and noticed this little pattern that worked for $13$ numbers. I tried to google it to get more information, but I couldn't find anything, so I decided appeal to the greater interweb for insight.
So here it is: If you take the numbers $\{1, 9, 25, 49, \dots, 625\}$ (i.e. the squares of odd numbers, but ONLY up to 625) and plug them into $$f(n) =\frac{n+12\sqrt{n}-13}{8}$$ the outputs are the same as the outputs of the prime counting function, $\pi(n)$, at those values. It's not completely exact, since $f(225)$ and $f(289)$ differ from the respective $\pi(225)$ and $\pi(289)$ by $1$, but otherwise $f(n)$ gives the same values.
So I was just curious as to why this happens. Are there other numbers or algebraic formulas that coicide with $\pi(n)$ like this, or is this just coincidence?
Any insight would be appreciated. Thank you in advance for your consideration. Have a wonderful day!
There are other numbers and formulas which do approximate $\pi(x)$. Note that $\pi(x)$ is very well approximated by $\frac{x}{\ln x}$. What is happening with your formula is I think essentially a coincidence. Your formula will break down badly when $n$ is large as your formula will give values much, much bigger than $\pi(x)$. For example, $\pi(10^6)$ is about 78,000, and your formula will predict around 120,000. In general, there are a lot of formulas which are easy to write down that only work for small values of $n$.