A116941 Permutation of the natural numbers in conjunction with A116939 and A003056.
0, 1, 3, 2, 4, 6, 5, 7, 9, 11, 8, 10, 12, 14, 16, 13, 15, 17, 19, 21, 23, 18, 20, 22, 24, 26, 28, 30, 25, 27, 29, 31, 33, 35, 37, 39, 32, 34, 36, 38, 40, 42, 44, 46, 48, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 61, 63, 65, 67, 69, 71, 73
Offset: 0
Keywords
Links
Programs
-
Haskell
a116941 n = a116941_list !! n a116941_list = f 0 1 (zip a116939_list [0..]) [] where f u v xis'@((x,i):xis) ws | x == u = i : f u v xis ws | x == v = f u v xis (i : ws) | otherwise = reverse ws ++ f v x xis' [] -- Reinhard Zumkeller, Jun 28 2013
-
Mathematica
Table[ Ceiling[(n -1)^2/2] + 2k -2, {n, 12}, {k, n}] // Flatten (* Robert G. Wilson v, Mar 09 2017 after Ivan Neretin in A074147 *)
Formula
a(n) = A074147(n+1) - 1. - Robert G. Wilson v, Mar 09 2017
Comments