OFFSET
0,2
COMMENTS
The orbit of 1 under iteration of this function is the Sierpinski gasket A038183. It is called "rule 90" because the 8 bits of 90 = 01011010 in binary give bit k of the result as function of the value in {0,...,7} made out of bits k,k+1,k+2 of the input (i.e., floor(input / 2^k) mod 8). - M. F. Hasler, Oct 09 2017
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..16383
FORMULA
a(n) = n XOR (4n). - M. F. Hasler, Oct 09 2017
EXAMPLE
n (in binary) | 4n [binary] | n XOR 4n [binary] | [decimal] = a(n)
0 | 0 | 0 | 0
1 | 100 | 101 | 5
10 | 1000 | 1010 | 10
11 | 1100 | 1111 | 15
100 | 10000 | 10100 | 20
101 | 10100 | 10001 | 17
etc.
MAPLE
a:= n-> Bits[Xor](n*4, n):
seq(a(n), n=0..120); # Alois P. Heinz, Aug 24 2019
MATHEMATICA
Table[ BitXor[4n, n], {n, 0, 60}] (* Robert G. Wilson v, Jul 06 2006 *)
PROG
(PARI) a(n)=bitxor(n, 4*n) \\ Charles R Greathouse IV, Oct 03 2016
(Python)
def A048725(n): return n^ n<<2 # Chai Wah Wu, Jun 29 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Antti Karttunen, Apr 26 1999
STATUS
approved