1,2

max(a(n)/n) approaches sqrt(3), and the indices of the maxima are apparently in A041017.

Table of n, a(n) for n=1..80.

a(n) = min (A033428(n)-A022838(n)^2, (1+A022838(n))^2-A033428(n)) = min [3*n^2 - (floor[n*sqrt(3)])^2, (1 + floor[n*sqrt(3)])^2 - 3*n^2].

a(9) = 13 because the difference between 3*9^2 = 243 and the nearest square number (256) is 13.

(PARI) a(n)=min(3*n^2-(floor(n*sqrt(3)))^2, (1+floor(n*sqrt(3)))^2-3*n^2)

Cf. A001951, A087060.

Sequence in context: A210858 A114586 A052174 * A181897 A212207 A111049

Adjacent sequences: A227787 A227788 A227789 * A227791 A227792 A227793

nonn

Ralf Stephan, Sep 23 2013

approved