cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A225850 Inverse of permutation in A167151.

This page as a plain text file.
%I A225850 #17 Jun 04 2022 21:17:18
%S A225850 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 A225850 11,42,44,46,48,50,52,54,56,13,58,60,62,64,66,68,70,72,74,15,76,78,80,
%U A225850 82,84,86,88,90,92,94,17,96,98,100,102,104,106,108,110,112
%N A225850 Inverse of permutation in A167151.
%C A225850 For n > 0: a(A005228(n)) = 2*n-1 and a(A030124(n)) = 2*n.
%C A225850 For n > 0: A232739(n) = a(A232739(n+1))/2. - _Antti Karttunen_, Dec 04 2013
%H A225850 Reinhard Zumkeller, <a href="/A225850/b225850.txt">Table of n, a(n) for n = 0..10000</a>
%H A225850 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A225850 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 A225850 nmax = 100; A5228 = {1};
%t A225850 Module[{d = 2, k = 1}, Do[While[MemberQ[A5228, d], d++]; k += d; d++; AppendTo[A5228, k], {n, 1, nmax}]];
%t A225850 a46[n_] := For[k = 1, True, k++, If[A5228[[k]] > n, Return[k - 1]]];
%t A225850 a47[n_] := If[n == 1, 1, a46[n] (a46[n] - a46[n - 1])];
%t A225850 a48[n_] := a48[n] = If[n == 1, 0, a48[n-1] + (1 - (a46[n] - a46[n-1]))];
%t A225850 a49[n_] := If[n == 1, 0, a48[n] (a48[n] - a48[n - 1])];
%t A225850 a[n_] := If[n < 3, n, 2 (a47[n] + a49[n]) - (a46[n] - a46[n - 1])];
%t A225850 Table[a[n], {n, 0, nmax}] (* _Jean-François Alcover_, Dec 09 2021 *)
%o A225850 (Haskell)
%o A225850 import Data.List (elemIndex)
%o A225850 import Data.Maybe (fromJust)
%o A225850 a225850 = fromJust . (`elemIndex` a167151_list)
%o A225850 (Scheme)
%o A225850 (define (A225850 n) (if (< n 3) n (- (* 2 (+ (A232747 n) (A232749 n))) (- (A232746 n) (A232746 (- n 1))))))
%o A225850 ;; _Antti Karttunen_, Dec 04 2013
%Y A225850 Inverse permutation: A167151.
%Y A225850 Cf. also A005228, A030124, A232739, A232746, A232747, A232749, and also the permutation pair A232751/A232752.
%K A225850 nonn
%O A225850 0,3
%A A225850 _Reinhard Zumkeller_, May 17 2013