login
Permutation of the natural numbers in conjunction with A116939 and A003056.
5

%I #21 Oct 08 2017 23:47:18

%S 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,

%T 28,30,25,27,29,31,33,35,37,39,32,34,36,38,40,42,44,46,48,41,43,45,47,

%U 49,51,53,55,57,59,50,52,54,56,58,60,62,64,66,68,70,61,63,65,67,69,71,73

%N Permutation of the natural numbers in conjunction with A116939 and A003056.

%C Inverse: A116942;

%C A003056(n) = A116939(a(n)).

%H Reinhard Zumkeller, <a href="/A116941/b116941.txt">Table of n, a(n) for n = 0..10000</a>

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

%F a(n) = A074147(n+1) - 1. - _Robert G. Wilson v_, Mar 09 2017

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

%o (Haskell)

%o a116941 n = a116941_list !! n

%o a116941_list = f 0 1 (zip a116939_list [0..]) [] where

%o f u v xis'@((x,i):xis) ws

%o | x == u = i : f u v xis ws

%o | x == v = f u v xis (i : ws)

%o | otherwise = reverse ws ++ f v x xis' []

%o -- _Reinhard Zumkeller_, Jun 28 2013

%K nonn

%O 0,3

%A _Reinhard Zumkeller_, Feb 27 2006