%I#9 2022年5月30日16:32:41
%S 1,3,7,7,31,63,15,15511,63204710235116383,3134095873814095,
%电话:10231271409583886072097151255671088631048575511536870911,
%电话:1073741823,63
%N反转细胞自动机规则90中长度为2*N的模式所需的步骤数。
%H Rich Holmes,<a href=“http://web.syr.edu/~rsholmes/games/cellaut/r90.html“>测线段上的规则90</a>
%H Eric Weisstein的数学世界,<a href=“http://mathworld.wolfram.com/Rule90.html“>规则90</a>
%F对于n=2^m,似乎a(n)=2*n-1。
%e a(3)=7,因为规则90中长度为2*n=6的所有模式都在7个细胞自动机步骤中镜像。
%o(Java)公共类Rule90{public static void main(String args[]){for(int len=2;len<100;len+=2){long count=1;for(int i=0;i<len;i++)count*=2;int max=-1;for(inti=0;i<count;i++){lond value=i;
%o//反向值长反向=0;for(long b1=1,b2=count/2;b2>0;b1*=2,b2/=2){if((value&b1)!=0)reverse |=b2;}
%o//反转int步骤的计数步骤=0;长电流=值;while(current!=reverse){steps++;current=(current>>1)^(curvent<<1)&(count-1);}
%o//如果(steps>max)max=steps;},则检查是否大于当前最大值System.out.println(最大值+“,”);}}}
%K nonn公司
%O 1,2号机组
%A Frank Buss,2003年8月8日
|