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 A115304 #41 Apr 07 2025 19:39:00 %S A115304 1,2,3,7,6,5,4,11,10,9,8,15,14,13,12,31,30,29,28,27,26,25,24,23,22,21, %T A115304 20,19,18,17,16,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,63,62, %U A115304 61,60,59,58,57,56,55,54,53,52,51,50,49,48,127,126,125,124,123,122,121 %N A115304 a(n) = n if n < 4, otherwise 4*a(floor(n/4)) + 3 - n mod 4. %C A115304 Self-inverse permutation of the natural numbers. %C A115304 If n is written in base-4 representation, then a(n) is the value after replacing all digits d (except for the leading one) by 3-d. %H A115304 Paolo Xausa, <a href="/A115304/b115304.txt">Table of n, a(n) for n = 1..10000</a> %H A115304 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A115304 a(n) = A115310(n+2,3). %F A115304 a(n) = n XOR (4^A102572(n) - 1). - _Alan Michael Gómez Calderón_, Mar 27 2025 %F A115304 a(a(n)) = n. - _A.H.M. Smeets_, Apr 01 2025 %t A115304 A115304[n_] := FromDigits[MapAt[3 - # &, IntegerDigits[n, 4], 2;;], 4]; %t A115304 Array[A115304, 100] (* _Paolo Xausa_, May 20 2024 *) %o A115304 (Python) %o A115304 def A115304(n): # according to Formula by _Alan Michael Gómez Calderón_ %o A115304 m = 4**floor(log(n,4))-1 %o A115304 return n^m # _A.H.M. Smeets_, Apr 01 2025 %Y A115304 Cf. A054429, A102572, A115303, A115305, A115306, A115307, A115308, A115309, A106649. %K A115304 nonn,base %O A115304 1,2 %A A115304 _Reinhard Zumkeller_, Jan 20 2006