Search NKS | Online
51 - 60 of 115 for IntegerDigits
Corresponding to the result on page 870 for rule 90, the number of black cells at row t in the pattern from rule 150 is given by
Apply[Times, Map[(2 # + 2 - (-1) # + 2 )/3 &, Cases[Split[IntegerDigits[t, 2]], k:{1 ..} Length[k]]]]
There are a total of 2 m Fibonacci[m+2] black cells in the pattern obtained up to step 2 m , implying fractal dimension Log[2, 1 + Sqrt[5]] . … The value at step t in the column immediately adjacent to the center is the nested sequence discussed on page 892 and given by Mod[IntegerExponent[t, 2], 2] .
Successive steps in the iterative procedure used on this page are given by
Move[list_] := (If[Cost[#] < Cost[list], #, list] &)[ MapAt[1 - # &, list, Random[Integer, {1, Length[list]}]]]
while those in the procedure on page 347 have ≤ in place of < . The third curve shown on page 346 is obtained from
Table[Cost[IntegerDigits[i, 2, n]], {i, 0, 2 n - 1}]
There is no single ordering that makes all states which can be reached by changing a single square be adjacent.
For a rule with number n the two operations correspond respectively to computing 1 - Reverse[list] and list 〚 {1, 5, 3, 7, 2, 6, 4, 8} 〛 with list = IntegerDigits[n, 2, 8] .
Implementation [of hexagonal cellular automata]
One can treat hexagonal lattices as distorted square lattices, updated according to
CAStep[rule_List, a_] := Map[rule 〚 14 - # 〛 &, a + 2 ListConvolve[{{1, 1, 0}, {1, 0, 1}, {0, 1, 1}}, a, 2], {2}]
where rule = IntegerDigits[code, 2, 14] .
With the state of a 2-color tag system encoded as an integer according to FromDigits[Reverse[list] + 1, 3] the following takes the rule for any such tag system (in the first form from page 894 ) and yields a primitive recursive function that emulates a single step in its evolution:
TSToPR[{n_, rule_}] := Fold[Apply[c, Flatten[{#1, Array[p, #
2], c[r[z, c[r[p[1], s], c[r[z, p[2]], c[r[z, r[c[s, z], c[r[c[s,
c[s, z]], z], p[2]]]], p[2]]], p[1]]], p[#2]]}]] & , c[c[r[p[1],
s], p[1], c[r[p[1], r[z, c[s, c[s, s]]]], c[c[r[z, c[r[p[1], s],
c[r[z, c[s, z]], c[r[p[1], r[z, c[r[p[1], s], c[r[z, p[2]], c[
r[z, r[c[s, z], c[r[c[s, c[s, z]], z], p[2]]]], p[2]]], p[1]]]],
p[2], p[3]]], p[1]]], p[1], p[1]], p[1]], p[2]]], p[n + 1],
MapIndexed[c[r[z, c[r[p[1], p[4]], p[2], p[3], p[4]]], c[r[z,
r[c[s, z], c[r[c[s, c[s, z]], z], p[2]]]], p[Length[#2] + 1]], #
1 〚 1 〛 , #1 〚 2 〛 ] & , Nest[Partition[#1, 2] & , Table[Nest[c[s, #] &
z, FromDigits[Reverse[IntegerDigits[i, 2, n] /. rule] + 1, 3]],
{i, 0, 2 n - 1}], n - 1], {0, n - 1}]], Range[n, 1, -1]]
(For tag system (a) from page 94 this yields a primitive recursive function of size 325.) … Note that the same basic approach can be used to emulate Turing machines with recursive functions; the Turing machine configuration {s, list, n} can be encoded by an integer such as
2^FromDigits[Reverse[Take[list, n - 1]]] 3^FromDigits[Take[list, {n + 1, -1}]] 5^list 〚 n 〛 7 s
Rest[list]/#1) &, Apply[ ExtendedGCD, Drop[list, -1]]]}, {Mod[ α , #], #} &[ Fold[GCD[#1, If[#1 0, #2, Mod[#2, #1]]] &, 0, ListCorrelate[{ α , -1}, list]]]]
With slightly more effort both x and {a, m} can be found just from First[IntegerDigits[list, 2, p]] .
It is related to (a) by Gray code reordering of the rows, and to (b) by reordering according to (see page 905 )
BitReverseOrder[a_] := With[{n = Length[a]}, a 〚 Map[FromDigits[Reverse[#], 2] &, IntegerDigits[Range[0, n - 1], 2, Log[2, n]]] + 1 〛 ]
It is also given by
Array[Apply[Times, (-1)^(IntegerDigits[#1, 2, s] Reverse[IntegerDigits[#2, 2, s]])] &, 2^{s,s}, 0]
where (b) is obtained simply by dropping the Reverse .
With k possible colors for each cell, there are a total of k k 2 possible rules of this type, each specified by a k 2 -digit number in base k (7743 for the rule shown above). … With rule given by IntegerDigits[num, k, k 2 ] a single step of evolution can be implemented as
CAStep[{k_, rule_}, a_List] := rule 〚 k 2 - RotateLeft[a] - k a 〛
Nested digit sequences
The number obtained from the substitution system {1 {1, 0}, 0 {0, 1}} is approximately 0.587545966 in base 10. … From the result on page 890 , the number whose digits are obtained from {1 {1, 0}, 0 {1}} is given by Sum[2^(-Floor[n GoldenRatio]), {n, ∞ }] . … But then there is a general result that if a particular sequence of power series coefficients can be obtained from an algebraic (but not rational) function modulo a particular p , then it can only be obtained from transcendental functions modulo any other p —or over the integers.
Sequence (f) is formed by concatenating base 2 digits of successive integers. … Sequence (h) is the base 2 digits of π .