Chemistry - Is there a function to approximate atomic mass from the atomic number?

The short answer is that you can find a power-law fit ($1.61Z^{1.1}$) with low average error.

I'd never really thought about it much, but after downloading the IUPAC Atomic Weights, I decided to do some curve fitting.

Here's a linear fit between atomic number and atomic mass: linear fit of atomic mass from atomic number

As you say, the fit isn't very good for small $Z$, but the overall fit isn't bad - the mean absolute error (MAE) is $2.821 \:\mathrm{u}$, and taken as a whole, the data is surprisingly linear. (Well, surprising to me.)

So I thought of a quadratic fit, requiring the intercept to be 0,0 to ensure the best fit for small $Z$:

quadratic fit of atomic mass from atomic number

Looks better, right? Certainly the fit is much better for first and second row elements, but the MAE only reduces to $2.749 \:\mathrm{u}$.

So I went up to a cubic fit, again requiring 0,0 for the intercepts:

cubic fit of atomic mass from atomic number

Aha, now we're talking! We get the subtle nonlinearities, and the MAE is down to $1.36 \:\mathrm{u}$.

Thanks to the comment by Nicolau below, I performed a power-law fit.

power-law fit

So that gives a power-law fit with MAE of $0.01 \:\mathrm{u}$ and a fairly easy-to remember function:

$m_a \approx 1.61Z^{1.1}$