login
A387312
a(n) is the action of "Rule 30" elementary cellular automaton on the binary representation of n if the cells may only expand into the significant bit.
3
0, 3, 7, 6, 14, 13, 13, 12, 28, 31, 27, 26, 26, 25, 25, 24, 56, 59, 63, 62, 54, 53, 53, 52, 52, 55, 51, 50, 50, 49, 49, 48, 112, 115, 119, 118, 126, 125, 125, 124, 108, 111, 107, 106, 106, 105, 105, 104, 104, 107, 111, 110, 102, 101, 101, 100, 100, 103, 99, 98, 98, 97, 97, 96, 224, 227, 231, 230, 238, 237, 237, 236, 252
OFFSET
0,2
COMMENTS
A269160 allows cells to expand in both directions; its example gives 111 -> 11001 (as opposed to this 111 -> 1100). This sequence does not allow the cells to expand into the least significant bit.
A269160 is a subsequence.
When calculating the LSB edge, the out-of-bounds cell is taken to be 0.
LINKS
Eric Weisstein's World of Mathematics, Rule 30.
The Wolfram Atlas of Simple Programs, Rule 30.
FORMULA
a(n) = Sum_{i=0..floor(log_2(n)+1)} 2^i * b(30, 4*b(n,i+1) + 2*b(n,i) + b(n,i-1)), where b(n,i) = floor(n/(2^i)) mod 2.
a(2*n) = A269160(n).
a(n) = (n OR 2*n) XOR floor(n/2). - Mia Boudreau, May 15 2026
EXAMPLE
For a(7): 111 -> 1100, so a(7) = 12.
For a(10): 1010 -> 11011, so a(10) = A269160(5) = 27.
MATHEMATICA
A387312[n_] := BitXor[BitOr[n, 2*n], Quotient[n, 2]];
Array[A387312, 100, 0] (* Paolo Xausa, May 20 2026 *)
PROG
(C)
unsigned long long a(unsigned long long n){return (n>>1)^(n|n<<1); }
CROSSREFS
Cf. A269160.
Sequence in context: A070882 A109635 A095360 * A175142 A318466 A324819
KEYWORD
nonn,base,easy
AUTHOR
Mia Boudreau, Aug 25 2025
STATUS
approved