A115304 a(n) = n if n < 4, otherwise 4*a(floor(n/4)) + 3 - n mod 4.
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, 20, 19, 18, 17, 16, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 127, 126, 125, 124, 123, 122, 121
Offset: 1
Links
Programs
-
Mathematica
A115304[n_] := FromDigits[MapAt[3 - # &, IntegerDigits[n, 4], 2;;], 4]; Array[A115304, 100] (* Paolo Xausa, May 20 2024 *)
-
Python
def A115304(n): # according to Formula by Alan Michael Gómez Calderón m = 4**floor(log(n,4))-1 return n^m # A.H.M. Smeets, Apr 01 2025
Formula
a(n) = A115310(n+2,3).
a(n) = n XOR (4^A102572(n) - 1). - Alan Michael Gómez Calderón, Mar 27 2025
a(a(n)) = n. - A.H.M. Smeets, Apr 01 2025
Comments