login
A269160
Formula for Wolfram's Rule 30 cellular automaton: a(n) = n XOR (2n OR 4n).
37
0, 7, 14, 13, 28, 27, 26, 25, 56, 63, 54, 53, 52, 51, 50, 49, 112, 119, 126, 125, 108, 107, 106, 105, 104, 111, 102, 101, 100, 99, 98, 97, 224, 231, 238, 237, 252, 251, 250, 249, 216, 223, 214, 213, 212, 211, 210, 209, 208, 215, 222, 221, 204, 203, 202, 201, 200, 207, 198, 197, 196, 195, 194, 193, 448, 455, 462
OFFSET
0,2
COMMENTS
Take n, write it in binary, see what Rule 30 would do to that state, convert it to decimal: that is a(n). For example, we can see in A110240 that 7 = 111_2 becomes 25 = 11001_2 under Rule 30, which is shown here by a(7) = 25. - N. J. A. Sloane, Nov 25 2016
The sequence is injective: no value occurs more than once.
Fibbinary numbers (A003714) give all integers n>=0 for which a(n) = A048727(n) and for which a(n) = A269161(n).
FORMULA
a(n) = n XOR (2n OR 4n) = A003987(n, A003986(2*n, 4*n)).
Other identities. For all n >= 0:
a(2*n) = 2*a(n).
a(n) = A057889(A269161(A057889(n))). [Rule 30 is the mirror image of rule 86.]
A269162(a(n)) = n.
For all n >= 1:
A070939(a(n)) - A070939(n) = 2. [The binary length of a(n) is two bits longer than that of n for all nonzero values.]
MATHEMATICA
a[n_] := BitXor[n, BitOr[2n, 4n]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Feb 23 2016 *)
PROG
(Scheme) (define (A269160 n) (A003987bi n (A003986bi (* 4 n) (* 2 n)))) ;; Where A003986bi and A003987bi are implementation of dyadic functions giving bitwise-OR (A003986) and bitwise-XOR (A003987) of their arguments.
(PARI) a(n) = bitxor(n, bitor(2*n, 4*n)); \\ Michel Marcus, Feb 23 2016
(Python)
def A269160(n): return n^(n<<1 | n<<2) # Chai Wah Wu, Jun 29 2022
CROSSREFS
Cf. A110240 (iterates starting from 1).
Cf. A269162 (left inverse).
Cf. A269163 (same sequence sorted into ascending order).
Cf. A269164 (values missing from this sequence).
Cf. also A048727, A269161.
Sequence in context: A307964 A225556 A064666 * A286418 A040042 A233366
KEYWORD
nonn
AUTHOR
Antti Karttunen, Feb 20 2016
STATUS
approved