OFFSET
0,3
COMMENTS
The trajectory of n under iteration of m -> a(m) is eventually constant iff n is a perfect square.
Conjecture (verified up to 727): the numbers not in this sequence are those of A008865. - R. J. Mathar, Jan 23 2009
From Maon Wenders, Jul 01 2012: (Start)
Proof of conjecture:
(1) (n+2)^2 - n^2 = n^2 + 4n + 4 - n^2 = 4n + 4
(2) (n+1)^2 - n^2 = n^2 + 2n + 1 - n^2 = 2n + 1
(3) (n+1) + square excess of (n+1) - (n + square excess of n) = 2, except when (n+1) is a square, where a(n) collapses back to (n+1)
(4) so, cause of (2) and (3), the sequence has blocks of even and odd numbers starting with an even or odd square, m^2 and of length 2m+1:
0,
1, 3, 5,
4, 6, 8, 10, 12,
9, 11, 13, 15, 17, 19, 21,
16, 18, 20, 22, 24, 26, 28, 30, 32,
...
(5) such a block of 2m+1 numbers fills in all even or odd numbers between
n^2 and (n+2)^2
(6) but, because a block starts n^2 + 0, n^2 + 2, n^2 + 4, ..., the last number in such a block is n^2 + 2*(2n+1-1) = n^2 + 4n
(7) so the numbers n^2 + 4n + 2 = (n+2)^2 - 2 are missing.
End of proof. (End)
LINKS
S. H. Weintraub, An interesting recursion, Amer. Math. Monthly, 111 (No. 6, 2004), 528-530.
FORMULA
a(n) = n + A053186(n).
MATHEMATICA
f[n_] := 2 n - (Floor@ Sqrt@ n)^2; Table[f@ n, {n, 0, 71}] (* Robert G. Wilson v, Jan 23 2009 *)
PROG
(PARI) a(n)=2*n-sqrtint(n)^2 \\ Charles R Greathouse IV, Jul 01 2012
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Jun 10 2004
STATUS
approved