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 A254116 #12 Jun 06 2017 10:33:16 %S A254116 1,2,3,4,5,6,7,8,13,10,11,12,9,14,17,16,41,26,23,20,15,22,19,24,67,18, %T A254116 37,28,47,34,29,32,27,82,61,52,73,46,43,40,89,30,21,44,59,38,31,48, %U A254116 111,134,107,36,57,74,33,56,149,94,79,68,83,58,25,64,359,54,181,164,193,122,101,104,229,146,49,92,85,86,71,80,185,178,139,60,95,42,39 %N A254116 Permutation of natural numbers: a(n) = A064216(A254103(n)). %H A254116 Antti Karttunen, <a href="/A254116/b254116.txt">Table of n, a(n) for n = 1..8192</a> %H A254116 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A254116 a(n) = A064216(A254103(n)). %F A254116 Other identities. For all n >= 1: %F A254116 a(n) = a(2n)/2. [Even bisection halved gives back the sequence itself.] %F A254116 A254118(n) = (a((2*n)+1) - 1)/2. [Likewise, the odd bisection induces A254118.] %o A254116 (PARI) %o A254116 default(primelimit, 2^30); %o A254116 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 A254116 A064216(n) = A064989((2*n)-1); %o A254116 A254103(n) = { if(0==n,0,if(!(n%2),(3*A254103(n/2))-1,(3*(1+A254103((n-1)/2)))\2)); }; %o A254116 A254116(n) = A064216(A254103(n)); %o A254116 for(n=1, 8192, write("b254116.txt", n, " ", A254116(n))); %o A254116 (Scheme) (define (A254116 n) (A064216 (A254103 n))) %o A254116 (Python) %o A254116 from sympy import factorint, prevprime, floor %o A254116 from operator import mul %o A254116 def a064216(n): %o A254116 f=factorint(2*n - 1) %o A254116 return 1 if n==1 else reduce(mul, [prevprime(i)**f[i] for i in f]) %o A254116 def a254103(n): %o A254116 if n==0: return 0 %o A254116 if n%2==0: return 3*a254103(n/2) - 1 %o A254116 else: return floor((3*(1 + a254103((n - 1)/2)))/2) %o A254116 def a(n): return a064216(a254103(n)) # _Indranil Ghosh_, Jun 06 2017 %Y A254116 Inverse: A254115. %Y A254116 Fixed points: A254099. %Y A254116 Related permutations: A064216, A254103, A254118. %K A254116 nonn %O A254116 1,2 %A A254116 _Antti Karttunen_, Feb 04 2015