The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A127366 Let m = floor(sqrt(n)); if n and m have the same parity, a(n) = n + m, otherwise a(n) = n - m. 4

%I #18 Aug 28 2016 18:23:42

%S 0,2,1,4,6,3,8,5,10,12,7,14,9,16,11,18,20,13,22,15,24,17,26,19,28,30,

%T 21,32,23,34,25,36,27,38,29,40,42,31,44,33,46,35,48,37,50,39,52,41,54,

%U 56,43,58,45,60,47,62,49,64,51,66,53,68,55,70,72,57,74,59,76,61,78,63,80

%N Let m = floor(sqrt(n)); if n and m have the same parity, a(n) = n + m, otherwise a(n) = n - m.

%C 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.

%C a(A133280(n,k)) mod 2 = 0 and a(A195437(n,k)) mod 2 = 1, 0 <= k < n. [_Reinhard Zumkeller_, Oct 12 2011]

%H T. D. Noe, <a href="/A127366/b127366.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%t 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 *)

%o (Haskell)

%o a127366 n | even n' = n'

%o | otherwise = 2*n - n'

%o where n' = n + a000196 n

%o -- _Reinhard Zumkeller_, Oct 12 2011

%Y Cf. A127367.

%Y Cf. A000196.

%K nice,nonn

%O 0,2

%A _Franklin T. Adams-Watters_, Jan 11 2007

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 16 05:56 EDT 2024. Contains 372549 sequences. (Running on oeis4.)