A256304 Apply the transformation 0 -> 1 -> 2 -> 3 -> 0 to the digits of n written in base 4; do not convert back to base 10.
1, 2, 3, 0, 21, 22, 23, 20, 31, 32, 33, 30, 1, 2, 3, 0, 211, 212, 213, 210, 221, 222, 223, 220, 231, 232, 233, 230, 201, 202, 203, 200, 311, 312, 313, 310, 321, 322, 323, 320, 331, 332, 333, 330, 301, 302, 303, 300, 11, 12, 13, 10, 21, 22, 23, 20, 31, 32
Offset: 0
Examples
a(4) = 21 because 4 = "10" (in base 4) becomes "21". a(15) = 0 because 15 = "33" (in base 4) becomes "00".
Programs
-
PARI
A256304(n,b=4)=!n+eval(Strchr(apply(d->(d+1)%b+48, digits(n,b))))
Comments