OFFSET
0,2
COMMENTS
This is a permutation of the nonnegative integers; it can also be generated by the rule (with m = floor(sqrt(n))): if n - m is not yet in the sequence, a(n) = n - m, otherwise a(n) = n + m. All cycles in this permutation are finite. There is one relatively large cycle starting at n = 4k^2 - 2k + 1 for each k and k 2-cycles for n = (2k - 1)^2 + 2i and (2k - 1)^2 + 2k - 1 + 2i with 0 <= i < k.
a(A133280(n,k)) mod 2 = 0 and a(A195437(n,k)) mod 2 = 1, 0 <= k < n. [Reinhard Zumkeller, Oct 12 2011]
LINKS
MATHEMATICA
a[n_] := If[m = Floor[Sqrt[n]]; OddQ[n] && OddQ[m] || EvenQ[n] && EvenQ[m], n+m, n-m]; Table[ a[n], {n, 0, 72}](* Jean-François Alcover, Nov 30 2011 *)
PROG
(Haskell)
a127366 n | even n' = n'
| otherwise = 2*n - n'
where n' = n + a000196 n
-- Reinhard Zumkeller, Oct 12 2011
CROSSREFS
KEYWORD
nice,nonn
AUTHOR
Franklin T. Adams-Watters, Jan 11 2007
STATUS
approved