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.

User: Benjamin Heiland

Benjamin Heiland's wiki page.

Benjamin Heiland has authored 1 sequences.

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.

Original entry on oeis.org

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, 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, 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
Offset: 1

Author

Benjamin Heiland, Feb 04 2011

Keywords

Comments

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.

Examples

			Cellular automaton defined by Rule 18 (with sizes in blank space):
(x is a 1 in the automaton, the numbers are the sizes of white spaces)
                x          ->
               x1x         ->1
              x 3 x        ->3
             x1x1x1x       ->1,1,1
            x   7   x      ->7
           x1x  5  x1x     ->1,5,1
          x 3 x 3 x 3 x    ->3,3,3
         x1x1x1x1x1x1x1x   ->1,1,1,1,1,1,1
and so on.
		

Crossrefs

Cf. A070886 (Rule 90 = Rule 18, starting with 1).

Programs

  • C
    #include
    #include
    int main(){
    int inumgen;                   //number of generations
    int *iacurrentgen;             //current generation
    int *ialastgen;                //last genereation (to calculate currentgen)
    int i=0;                       //loop counter
    int j=0;                       //another loop counter
    int nullcount=0;               //used to determinate whitespace size
    int a;                         //a for XOR to get new value
    int b;                         //b for XOR to get new value
    iacurrentgen=(int*)calloc(1,sizeof(int));
    ialastgen=(int*)calloc(1,sizeof(int));
    ialastgen[0]=1;
    printf("Calculating A185587\n");
    printf("please enter number of generations\n");
    printf("note that the number of sequence elements per Generation is fluctuating.\n");
    scanf("%d",&inumgen);
    i++;                           //we start at generation1 , not at offset.
    while(i<=inumgen){
      iacurrentgen=(int*)realloc(iacurrentgen,((i*2+1)*sizeof(int)));
      while(j<(i*2+1)){
       if((j-2)<0)
        a=0;
       else
        a=ialastgen[j-2];
       if(j>((i-1)*2))
        b=0;
       else
        b=ialastgen[j];
       iacurrentgen[j]=(a||b)&&!(a&&b);      //(a||b)&&!(a&&b)=aXORb
       j++;
      }
      j=0;
      ialastgen=(int*)realloc(ialastgen,((i*2+1)*sizeof(int)));
      while(j<=i*2){
       ialastgen[j]=iacurrentgen[j];
       if(iacurrentgen[j]==1){
        if(nullcount!=0){
         printf("%d,",nullcount);
         nullcount=0;
        }
       }
       if(iacurrentgen[j]==0){
        nullcount++;}
       j++;
      }
      j=0;
      printf("\n");
      i++;
    }
    }