BM3をバシク行列計算機に実装したところ、早速Nishさんが無限ループを指摘、そしてそれを見たバシクさんがBM2の停止しないパターンを見つけるということになり、残っている(停止しないパターンが見つかっていない)のはBM2.2と未実装のBM2.3だけになりました。
- 追記1:バシクさんによると、停止するというのは誤解でした。
- 追記2:さらにその後、Bubby3さんが4行行列の停止しないパターンを見つけました。
そして、早速バシクさんが新しいバージョンを作りました。
バシク行列数 16:19, June 30, 2018 バージョン
A=9:dim B[∞,∞],C[∞] for D=0 to 9 for E=0 to A B[1,E]=1 next for F=1 to 0 step -1 A=A*A for G=0 to F for H=0 to E if B[F-G,H]<B[F,H]-C[H] | B[F,0]=0 then if B[F,H+1]=0 then H=E:I=G:G=F else C[H]=B[F,H]-B[F-G,H] else H=E endif next next for J=1 to A for K=1 to I for L=0 to E B[F,L]=B[F-I,L] if K=1 | 0<B[F,L] then B[F,L]=B[F,L]+C[L] next F=F+1 next next for M=0 to E C[M]=0 next next next print A
例によって、yabasic での文法チェックとシミュレーションコードへの書き換えをしてチェックしました。
REM Simulates the calculation process of input sequence REM n = constant REM Maxmum length of sequence is 30 REM ======= Set initial variable ======= REM A$="(0)(1)(2)[2]" input "" A$ Z=30 REM maximum length of sequence dim B(Z,100),C(Z) I=0: J=0:B(0,0)=0 for M=1 to len(A$) B$=mid$(A$,M,1) if B$="," I=I+1: B(J,I)=0 if B$=")" J=J+1: E=I: I=0: B(J,J)=0 if B$="[" break if B$>="0" and B$<="9" B(J,I)=B(J,I)*10+val(B$) next M D=0 for M=M to len(A$) B$=mid$(A$,M,1) if B$>="0" and B$<="9" A=A*10+val(B$) next M if A=0 A=2 F=J-1 REM ======= Start calculation ======= for F=F to 0 step -1 for Y=0 to F print "("; for J=0 to E-1 print B(Y,J),","; next J print B(Y,E),")"; next Y print "[",A,"]" for G=0 to F for H=0 to E if B(F-G,H)<B(F,H)-C(H) or B(F,0)=0 then if B(F,H+1)=0 then H=E:I=G:G=F else C(H)=B(F,H)-B(F-G,H) endif else H=E endif next H next G for J=1 to A for K=1 to I for L=0 to E B(F,L)=B(F-I,L) if K=1 or 0<B(F,L) then B(F,L)=B(F,L)+C(L) endif next L F=F+1 if F>Z end next K next J for M=0 to E C(M)=0 next M next F
これをBM4として、BM3とBM4での動作の違いをとりあえず貼っておきます。実装はまたあとで。(追記:これは取り消されました)
BM3 (0,0,0)(1,1,1)(2,1,0)(1,1,1)[2] (0,0,0)(1,1,1)(2,1,0)(1,1,0)(2,2,1)(3,1,0)(2,2,0)(3,3,1)(4,1,0)[2] (0,0,0)(1,1,1)(2,1,0)(1,1,0)(2,2,1)(3,1,0)(2,2,0)(3,3,1)(4,0,0)(5,1,1)(6,1,0)(5,1,0)(6,2,1)(7,1,0)(6,2,0)(7,3,1)(8,0,0)(9,1,1)(10,1,0)(9,1,0)(10,2,1)(11,1,0)(10,2,0)(11,3,1)[2] BM4 (0,0,0)(1,1,1)(2,1,0)(1,1,1)[2] (0,0,0)(1,1,1)(2,1,0)(1,1,0)(2,2,1)(3,2,0)(2,2,0)(3,3,1)(4,3,0)[2] (0,0,0)(1,1,1)(2,1,0)(1,1,0)(2,2,1)(3,2,0)(2,2,0)(3,3,1)(4,2,0)(5,3,1)(6,2,0)(7,3,1)[2] BM3 (0,0,0)(1,1,1)(2,1,1)(1,1,1)[2] (0,0,0)(1,1,1)(2,1,1)(1,1,0)(2,2,1)(3,1,1)(2,2,0)(3,3,1)(4,1,1)[2] (0,0,0)(1,1,1)(2,1,1)(1,1,0)(2,2,1)(3,1,1)(2,2,0)(3,3,1)(4,1,0)(5,2,1)(6,1,1)(5,2,0)(6,3,1)(7,1,1)(6,3,0)(7,4,1)(8,2,0)(9,3,1)(10,1,1)(9,3,0)(10,4,1)(11,1,1)(10,4,0)(11,5,1)[2] BM4 (0,0,0)(1,1,1)(2,1,1)(1,1,1)[2] (0,0,0)(1,1,1)(2,1,1)(1,1,0)(2,2,1)(3,2,1)(2,2,0)(3,3,1)(4,3,1)[2] (0,0,0)(1,1,1)(2,1,1)(1,1,0)(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