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.

A185587 Irregular triangle read by rows: row n gives a list of the lengths of the free spaces at the n-th stage in a Rule 18 cellular automaton.

This page as a plain text file.
%I A185587 #24 Oct 21 2017 21:30:09
%S A185587 1,3,1,1,1,7,1,5,1,3,3,3,1,1,1,1,1,1,1,15,1,13,1,3,11,3,1,1,1,9,1,1,1,
%T A185587 7,7,7,1,5,1,5,1,5,1,3,3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,31,1,
%U A185587 29,1,3,27,3,1,1,1,25,1,1,1,7,23,7,1,5,1,21,1,5,1,3,3,3,19,3,3,3,1,1,1,1,1,1,1,17,1,1,1,1,1,1,1,15,15,15,1,13,1,13,1,13,1,3,11,3,11,3,11,3
%N A185587 Irregular triangle read by rows: row n gives a list of the lengths of the free spaces at the n-th stage in a Rule 18 cellular automaton.
%C A185587 a(n) is the size of the n^th free space inside the development of a Rule 18 CA (related to logical XOR) on a tape started with a single 1.
%H A185587 Benjamin Heiland, <a href="/A185587/b185587.txt">Table of n, a(n) for n = 1..154474</a>
%e A185587 Cellular automaton defined by Rule 18 (with sizes in blank space):
%e A185587 (x is a 1 in the automaton, the numbers are the sizes of white spaces)
%e A185587                 x          ->
%e A185587                x1x         ->1
%e A185587               x 3 x        ->3
%e A185587              x1x1x1x       ->1,1,1
%e A185587             x   7   x      ->7
%e A185587            x1x  5  x1x     ->1,5,1
%e A185587           x 3 x 3 x 3 x    ->3,3,3
%e A185587          x1x1x1x1x1x1x1x   ->1,1,1,1,1,1,1
%e A185587 and so on.
%o A185587 (C)
%o A185587 #include<stdio.h>
%o A185587 #include<stdlib.h>
%o A185587 int main(){
%o A185587 int inumgen;                   //number of generations
%o A185587 int *iacurrentgen;             //current generation
%o A185587 int *ialastgen;                //last genereation (to calculate currentgen)
%o A185587 int i=0;                       //loop counter
%o A185587 int j=0;                       //another loop counter
%o A185587 int nullcount=0;               //used to determinate whitespace size
%o A185587 int a;                         //a for XOR to get new value
%o A185587 int b;                         //b for XOR to get new value
%o A185587 iacurrentgen=(int*)calloc(1,sizeof(int));
%o A185587 ialastgen=(int*)calloc(1,sizeof(int));
%o A185587 ialastgen[0]=1;
%o A185587 printf("Calculating A185587\n");
%o A185587 printf("please enter number of generations\n");
%o A185587 printf("note that the number of sequence elements per Generation is fluctuating.\n");
%o A185587 scanf("%d",&inumgen);
%o A185587 i++;                           //we start at generation1 , not at offset.
%o A185587 while(i<=inumgen){
%o A185587   iacurrentgen=(int*)realloc(iacurrentgen,((i*2+1)*sizeof(int)));
%o A185587   while(j<(i*2+1)){
%o A185587    if((j-2)<0)
%o A185587     a=0;
%o A185587    else
%o A185587     a=ialastgen[j-2];
%o A185587    if(j>((i-1)*2))
%o A185587     b=0;
%o A185587    else
%o A185587     b=ialastgen[j];
%o A185587    iacurrentgen[j]=(a||b)&&!(a&&b);      //(a||b)&&!(a&&b)=aXORb
%o A185587    j++;
%o A185587   }
%o A185587   j=0;
%o A185587   ialastgen=(int*)realloc(ialastgen,((i*2+1)*sizeof(int)));
%o A185587   while(j<=i*2){
%o A185587    ialastgen[j]=iacurrentgen[j];
%o A185587    if(iacurrentgen[j]==1){
%o A185587     if(nullcount!=0){
%o A185587      printf("%d,",nullcount);
%o A185587      nullcount=0;
%o A185587     }
%o A185587    }
%o A185587    if(iacurrentgen[j]==0){
%o A185587     nullcount++;}
%o A185587    j++;
%o A185587   }
%o A185587   j=0;
%o A185587   printf("\n");
%o A185587   i++;
%o A185587 }
%o A185587 }
%Y A185587 Cf. A070886 (Rule 90 = Rule 18, starting with 1).
%K A185587 nonn,tabf
%O A185587 1,2
%A A185587 _Benjamin Heiland_, Feb 04 2011