OFFSET
1,4
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
Conjecture. Let t(k) be the largest triangular number t(k)=k(k+1)/2 such that 2t(k) is smaller than n and denote n-2t(k) by X. Then a(n)=X^2 if X<=k+1, else a(n)=(X-k-1)^2. (This has been verified for n=1,2,3,...,1000.) Illustration. For n=11, we find that 2t(2)=6<11 and 2t(3)=12>11, so that X=11-6=5 and k=2. X>k+1, so we get a(11)=(5-3)^2=4.
EXAMPLE
The orbit of 11 under the stated mapping is {11,8,6,4,4,4,4,...} so a(11)=4.
MAPLE
f:= proc(n) option remember;
if issqr(n) then n else procname(n - floor(sqrt(n))) fi
end proc:
map(f, [$1..100]); # Robert Israel, Oct 26 2020
MATHEMATICA
f[n_] := FixedPoint[ If[ IntegerQ@ Sqrt@#, #, # - Floor@ Sqrt@# ] &, n]; Array[f, 80] (* Robert G. Wilson v, Mar 08 2007 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
John W. Layman, Mar 05 2007
STATUS
approved