login
A227790
Difference between 3n^2 and the nearest square number.
1
1, 3, 2, 1, 6, 8, 3, 4, 13, 11, 2, 9, 22, 12, 1, 16, 26, 11, 6, 25, 27, 8, 13, 36, 26, 3, 22, 48, 23, 4, 33, 47, 18, 13, 46, 44, 11, 24, 61, 39, 2, 37, 71, 32, 9, 52, 66, 23, 22, 69, 59, 12, 37, 88, 50, 1, 54, 92, 39, 16, 73, 83, 26, 33, 94, 72, 11, 52, 117, 59, 6, 73, 111, 44, 25, 96, 98, 27, 46, 121
OFFSET
1,2
COMMENTS
max(a(n)/n) approaches sqrt(3), and the indices of the maxima are apparently in A041017.
FORMULA
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].
EXAMPLE
a(9) = 13 because the difference between 3*9^2 = 243 and the nearest square number (256) is 13.
PROG
(PARI) a(n)=min(3*n^2-(floor(n*sqrt(3)))^2, (1+floor(n*sqrt(3)))^2-3*n^2)
CROSSREFS
Sequence in context: A210858 A114586 A052174 * A181897 A337977 A212207
KEYWORD
nonn
AUTHOR
Ralf Stephan, Sep 23 2013
STATUS
approved