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.
%I A220347 #23 Jun 06 2025 19:17:38 %S A220347 1,2,3,4,6,5,8,12,10,7,16,24,20,14,11,32,48,40,28,22,9,64,96,80,56,44, %T A220347 18,15,128,192,160,112,88,36,30,23,256,384,320,224,176,72,60,46,19, %U A220347 512,768,640,448,352,144,120,92,38,13,1024,1536,1280,896,704,288 %N A220347 Permutation of natural numbers: a(1) = 1, a(triangular(n)) = (2*a(n))-1, a(nontriangular(n)) = 2*n, where triangular = A000217, nontriangular = A014132. %C A220347 Inverse permutation of A183079, when seen as a flattened sequence. %H A220347 Reinhard Zumkeller (first 250 terms) & Antti Karttunen, <a href="/A220347/b220347.txt">Table of n, a(n) for n = 1..10440</a> %H A220347 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A220347 a(1) = 1; for n > 1: if A010054(n) = 1 [i.e., if n is triangular], then a(n) = (2*a(A002024(n)))-1, otherwise a(n) = 2*a(A083920(n)). - _Antti Karttunen_, May 18 2015 %t A220347 a[n_] := a[n] = With[{r = (-1 + Sqrt[8n + 1])/2}, Which[n <= 1, n, IntegerQ[r], 2 a[Floor[Sqrt[2n] + 1/2]] - 1, True, 2 a[n - Floor[r]]]]; %t A220347 Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Dec 05 2021 *) %o A220347 (Haskell) %o A220347 import Data.List (elemIndex) %o A220347 import Data.Maybe (fromJust) %o A220347 a220347 = (+ 1) . fromJust . (`elemIndex` a183079_list) %o A220347 (Scheme) %o A220347 ;; With memoizing definec-macro. %o A220347 (definec (A220347 n) (cond ((<= n 1) n) ((zero? (A010054 n)) (* 2 (A220347 (A083920 n)))) (else (+ -1 (* 2 (A220347 (A002024 n))))))) %o A220347 ;; _Antti Karttunen_, May 18 2015 %Y A220347 Inverse: A183079. %Y A220347 Cf. A000217, A002024, A010054, A014132, A083920, A220348. %Y A220347 Cf. also a similar permutation A257797 from which this differs for the first time at n=15, where a(15) = 11, while A257797(15) = 9. %K A220347 nonn %O A220347 1,2 %A A220347 _Reinhard Zumkeller_, Dec 12 2012 %E A220347 Old name moved to comments by _Antti Karttunen_, May 18 2015