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 A254118 #22 May 06 2021 16:31:47 %S A254118 1,2,3,6,5,4,8,20,11,7,9,33,18,23,14,13,30,36,21,44,10,29,15,55,53,28, %T A254118 16,74,39,41,12,179,90,96,50,114,24,42,35,92,69,47,19,86,25,51,26,236, %U A254118 153,110,81,101,22,45,48,221,113,119,56,77,65,38,17,546,182 %N A254118 Permutation of natural numbers: a(n) = A249745(1+A254103(n)) - 1. %H A254118 Antti Karttunen, <a href="/A254118/b254118.txt">Table of n, a(n) for n = 1..8191</a> %H A254118 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A254118 a(n) = A249745(1+A254103(n)) - 1. %F A254118 a(n) = (A254116((2*n)+1)-1) / 2. [Obtained also from the odd bisection of A254116.] %o A254118 (PARI) %o A254118 default(primelimit, 2^30); %o A254118 A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)}; %o A254118 A064216(n) = A064989((2*n)-1); %o A254118 A254103(n) = { if(0==n,0,if(!(n%2),(3*A254103(n/2))-1,(3*(1+A254103((n-1)/2)))\2)); }; %o A254118 A254116(n) = A064216(A254103(n)); %o A254118 A254118(n) = (A254116(n+n+1)-1)/2; %o A254118 for(n=1, 8191, write("b254118.txt", n, " ", A254118(n))); %o A254118 (Scheme, two versions) %o A254118 (define (A254118 n) (+ -1 (A249745 (+ 1 (A254103 n))))) %o A254118 (define (A254118 n) (/ (+ -1 (A254116 (+ 1 n n))) 2)) %o A254118 (Python) %o A254118 from sympy import factorint, prevprime, floor %o A254118 from operator import mul %o A254118 from functools import reduce %o A254118 def a064216(n): %o A254118 f=factorint(2*n - 1) %o A254118 return 1 if n==1 else reduce(mul, [prevprime(i)**f[i] for i in f]) %o A254118 def a254103(n): %o A254118 if n==0: return 0 %o A254118 if n%2==0: return 3*a254103(n//2) - 1 %o A254118 else: return floor((3*(1 + a254103((n - 1)/2)))//2) %o A254118 def a254116(n): return a064216(a254103(n)) %o A254118 def a(n): return (a254116(2*n + 1) - 1)//2 %o A254118 print([a(n) for n in range(1, 101)]) # _Indranil Ghosh_, Jun 06 2017 %Y A254118 Inverse: A254117. %Y A254118 Other related permutations: A254116, A249745, A254103 (compare to the scatterplot of this one). %Y A254118 Cf. A254120 (= a(2^n)). %K A254118 nonn,look %O A254118 1,2 %A A254118 _Antti Karttunen_, Feb 05 2015