Background: I'm making a program in java to calculate all the primes between 1 and any given number ($\pi(x)$). I want to create an array that will contain all the numbers, but resizing an array takes time. The solution I came up with was to initialize the array with more possible elements than I know I will need. The problem with that is that I don't know the greatest possible number of elements I will need.
This page show how to approximate $\pi(x)$ with $\frac{x}{\log x - 1}$, but I want to find a fairly simple function such that $f(x)$ is always $\ge \pi(x)$. I considered using something similar to $1.1(\frac{x}{\log x - 1})$, but there is a possibility that $\pi(x) - \frac{x}{\log x - 1}$ increases exponentially.
Does anybody know of an equation for $f(x)$ so that for every value of $x$, $f(x)$ is greater than—but still as close as possible to—$\pi(x)$?