%I #17 Jun 04 2022 21:17:18
%S 0,1,2,3,4,6,8,5,10,12,14,16,7,18,20,22,24,26,9,28,30,32,34,36,38,40,
%T 11,42,44,46,48,50,52,54,56,13,58,60,62,64,66,68,70,72,74,15,76,78,80,
%U 82,84,86,88,90,92,94,17,96,98,100,102,104,106,108,110,112
%N Inverse of permutation in A167151.
%C For n > 0: a(A005228(n)) = 2*n-1 and a(A030124(n)) = 2*n.
%C For n > 0: A232739(n) = a(A232739(n+1))/2. - _Antti Karttunen_, Dec 04 2013
%H Reinhard Zumkeller, <a href="/A225850/b225850.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 If n < 3, a(n) = n, otherwise a(n) = (2*(A232747(n)+A232749(n))) - (A232746(n)-A232746(n-1)). - _Antti Karttunen_, Dec 04 2013
%t nmax = 100; A5228 = {1};
%t Module[{d = 2, k = 1}, Do[While[MemberQ[A5228, d], d++]; k += d; d++; AppendTo[A5228, k], {n, 1, nmax}]];
%t a46[n_] := For[k = 1, True, k++, If[A5228[[k]] > n, Return[k - 1]]];
%t a47[n_] := If[n == 1, 1, a46[n] (a46[n] - a46[n - 1])];
%t a48[n_] := a48[n] = If[n == 1, 0, a48[n-1] + (1 - (a46[n] - a46[n-1]))];
%t a49[n_] := If[n == 1, 0, a48[n] (a48[n] - a48[n - 1])];
%t a[n_] := If[n < 3, n, 2 (a47[n] + a49[n]) - (a46[n] - a46[n - 1])];
%t Table[a[n], {n, 0, nmax}] (* _Jean-François Alcover_, Dec 09 2021 *)
%o (Haskell)
%o import Data.List (elemIndex)
%o import Data.Maybe (fromJust)
%o a225850 = fromJust . (`elemIndex` a167151_list)
%o (Scheme)
%o (define (A225850 n) (if (< n 3) n (- (* 2 (+ (A232747 n) (A232749 n))) (- (A232746 n) (A232746 (- n 1))))))
%o ;; _Antti Karttunen_, Dec 04 2013
%Y Inverse permutation: A167151.
%Y Cf. also A005228, A030124, A232739, A232746, A232747, A232749, and also the permutation pair A232751/A232752.
%K nonn
%O 0,3
%A _Reinhard Zumkeller_, May 17 2013