cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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 bits.

This page as a plain text file.
%I A387312 #25 Sep 04 2025 10:52:48
%S A387312 0,3,7,6,14,13,13,12,28,31,27,26,26,25,25,24,56,59,63,62,54,53,53,52,
%T A387312 52,55,51,50,50,49,49,48,112,115,119,118,126,125,125,124,108,111,107,
%U A387312 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
%N 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 bits.
%C A387312 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 bits.
%C A387312 A269160 is a subsequence.
%C A387312 When calculating the LSB edge, the out-of-bounds cell is taken to be 0.
%H A387312 Mia Boudreau, <a href="/A387312/b387312.txt">Table of n, a(n) for n = 0..9999</a>
%H A387312 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Rule30.html">Rule 30</a>
%H A387312 The Wolfram Atlas of Simple Programs, <a href="https://atlas.wolfram.com/01/01/30/">Rule 30</a>
%F A387312 a(2*n) = A269160(n).
%e A387312 For a(7): 111 -> 1100, so a(7) = 12.
%e A387312 For a(10): 1010 -> 11011, so a(10) = A269160(5) = 27.
%o A387312 (C)
%o A387312 unsigned long long a(unsigned long long n){
%o A387312  unsigned char rule = 30;
%o A387312  unsigned long long x = 0;
%o A387312  int l = sizeof(unsigned long long) * 8;
%o A387312  for(int i = 0; i < l; i++)
%o A387312   x|=((rule>>(((n>>(i+1)&(i<l-1))<<2)|((n>>i&1)<<1)|(n>>(i-1)&(i>0))))&1)<<i;
%o A387312  return x;
%o A387312 }
%Y A387312 Cf. A269160.
%K A387312 nonn,new
%O A387312 0,2
%A A387312 _Mia Boudreau_, Aug 25 2025