%I #42 Mar 12 2021 22:24:42
%S 0,0,1,2,0,1,2,3,4,0,1,2,3,4,5,6,0,1,2,3,4,5,6,7,8,0,1,2,3,4,5,6,7,8,
%T 9,10,0,1,2,3,4,5,6,7,8,9,10,11,12,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,
%U 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,0,1,2,3,4,5,6,7,8,9,10,11,12,13
%N Square excess of n: difference between n and largest square <= n.
%C From _David W. Wilson_, Jan 05 2009: (Start)
%C More generally we may consider sequences defined by:
%C a(n) = n^j - (largest k-th power <= n^j),
%C a(n) = n^j - (largest k-th power < n^j),
%C a(n) = (largest k-th power >= n^j) - n^j,
%C a(n) = (largest k-th power > n^j) - n^j,
%C for small values of j and k.
%C The present entry is the first of these with j = 1 and n = 2.
%C It might be interesting to add further examples to the OEIS. (End)
%C a(A000290(n)) = 0; a(A005563(n)) = 2*n. - _Reinhard Zumkeller_, May 20 2009
%C 0 ^ a(n) = A010052(n). - _Reinhard Zumkeller_, Feb 12 2012
%C From _Frank M Jackson_, Sep 21 2017: (Start)
%C The square excess of n has a reference in the Bakhshali Manuscript of Indian mathematics elements of which are dated between AD 200 and 900. A section within describes how to estimate the approximate value of irrational square roots. It states that for n an integer with an irrational square root, let b^2 be the nearest perfect square < n and a (=a(n)) be the square excess of n, then
%C sqrt(n) = sqrt(b^2+a) ~ b + a/(2b) - (a/(2b))^2/(2(b+a/(2b))). (End)
%H Reinhard Zumkeller, <a href="/A053186/b053186.txt">Table of n, a(n) for n = 0..10000</a>
%H H. Bottomley, <a href="/A000196/a000196.gif">Illustration of A000196, A048760, A053186</a>
%H J. J. O'Connor, E. F. Robertson.<a href="http://www-history.mcs.st-andrews.ac.uk/HistTopics/Bakhshali_manuscript.html">The Bakhshali manuscript</a>, Historical Topics, St Andrews University.
%H Michael Somos, <a href="/A073189/a073189.txt">Sequences used for indexing triangular or square arrays</a>
%H S. H. Weintraub, <a href="http://www.jstor.org/stable/4145074">An interesting recursion</a>, Amer. Math. Monthly, 111 (No. 6, 2004), 528-530.
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Bakhshali_manuscript">Bakhshali manuscript</a>
%F a(n) = n - A048760(n) = n - floor(sqrt(n))^2.
%F a(n) = f(n,1) with f(n,m) = if n < m then n else f(n-m,m+2). - _Reinhard Zumkeller_, May 20 2009
%p A053186 := proc(n) n-(floor(sqrt(n)))^2 ; end proc;
%t f[n_] := n - (Floor@ Sqrt@ n)^2; Table[f@ n, {n, 0, 94}] (* _Robert G. Wilson v_, Jan 23 2009 *)
%o (PARI) A053186(n)= { if(n<0,0,n-sqrtint(n)^2) }
%o (Haskell)
%o a053186 n = n - a048760 n
%o a053186_list = f 0 0 (map fst $ iterate (\(y,z) -> (y+z,z+2)) (0,1))
%o where f e x ys'@(y:ys) | x < y = e : f (e + 1) (x + 1) ys'
%o | x == y = 0 : f 1 (x + 1) ys
%o -- _Reinhard Zumkeller_, Apr 27 2012
%Y Cf. A002262, A048760. A071797(n) = 1 + a(n-1).
%Y Cf. A002262. - _Reinhard Zumkeller_, May 20 2009
%Y Cf. A048760, A000196.
%K easy,nonn
%O 0,4
%A _Henry Bottomley_, Mar 01 2000