# Search NKS | Online

1 - 10 of 41 for IntegerQ
Conway considered fraction systems based on rules of the form FSEvolveList[fracs_, init_, t_] := NestList[First[Select[fracs #, IntegerQ, 1]] &, init, t] With the choice fracs = {17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/ 23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1} starting at 2 the result for Log[2, list] is as shown below, where Rest[Log[2, Select[list, IntegerQ[Log[2, #]] &]]] gives exactly the primes. (Compare the discussion of universality in integer equations on page 786 .)
Connection [of geometric substitution systems] with digit sequences Patterns after t steps can be viewed as containing all t -digit integers in an appropriate complex base. Thus the patterns on page 189 can be formed from t -digit integers in base  - 1 containing only digits 0 and 1, as given by Table[FromDigits[IntegerDigits[s, 2, t],  - 1], {s, 0, 2 t -1}] In the particular case of base  - q with digits 0 through q 2 , it turns out that for sufficiently large t any complex integer can be represented, and will therefore be part of the pattern.
The number of steps for which a cell at position n will survive can be computed as Module[{q = n + k - 1, s = 1}, While[Mod[q, k] ≠ 0, q = Ceiling[(k - 1)q/k]; s++]; s] If a cell is going to survive for s steps, then it turns out that this can be determined by looking at the last s digits in the base k representation of its position. For k = 2 , a cell survives for s steps if these digits are all 0 (so that s  IntegerExponent[n, k] ). … The solution is Fold[Mod[#1 + k, #2, 1]&, 0, Range[n]] , or FromDigits[RotateLeft[IntegerDigits[n, 2]], 2] for k = 2 .
Mobile automata [emulating cellular automata] Given the rules for an elementary cellular automaton in the form used on page 867 , the following will construct a mobile automaton which emulates it: vals = {x, p[0], q[0, 0], q[0, 1], q[1, 0], q[1, 1], p[1]} CAToMA[rules_] := Table[(#  Replace[#, {{q[a_, b_], p[c_], p[d_]}  {q[c, {a, c, d} /. rules], 1}, {q[a_, b_], p[c_], x}  {q[c, {a, c, 0} /. rules], 1}, {q[_, _], x, x}  {p[0], -1}, {q[_, _], q[_, a_], p[_]}  {p[a], -1}, {x, q[_, a_], p[_]}  {p[a], -1}, {x, x, p[_]}  {q[0, 0], 1}, {_, _, _}  {x, 0}}]) &[vals 〚 IntegerDigits[i, 7, 3] + 1 〛 ], {i, 0, 7 3 - 1}] The ordering in vals defines a mapping of symbolic cell values onto colors.
Operator systems One can represent the possible values of expressions like f[f[p, q], p] by rule numbers analogous to those used for cellular automata. Specifying an operator f (taken in general to have n arguments with k possible values) by giving the rule number u for f[p, q, …] , the rule number for an expression with variables vars can be obtained from With[{m = Length[vars]}, FromDigits[ Block[{f = Reverse[IntegerDigits[u, k, k n ]] 〚 FromDigits[ {##}, k] + 1 〛 &}, Apply[Function[Evaluate[vars], expr], Reverse[Array[IntegerDigits[# - 1, k, m] &, k m ]], {1}]], k]]
Counting of [network] nodes The number of nodes reached by going out to network distance r (with r > 1 ) from any node in the networks on page 477 is (a) 4r - 4 , (b) 3r 2 /2 - 3r/2 + 1 , and (c) First[Select[4r 3 /9 + 2r 2 /3 + {2, 5/3, 5/3} r - {10/9, 1, -4/9}, IntegerQ]] In any trivalent network, the quantity f[r] obtained by adding up the numbers of nodes reached by going distance r from each node must satisfy f[0] = n and f[1] = 3n , where n is the total number of nodes in the network.
In general, if a period m is possible then so must all periods n for which p = {m, n} satisfies OrderedQ[Transpose[If[MemberQ[p/#, 1], Map[Reverse, {p/#, #}], {#, p/#}]] &[2^IntegerExponent[p, 2]]] Extensions of this to other types of systems seem difficult to find, but it is conceivable that when viewed as continuous mappings on a Cantor set (see page 869 ) at least some cellular automata might exhibit similar properties.
The positions of the black cells are given by (and this establishes the connection with the picture on page 117 ) Fold[Flatten[{#1 - #2, #1 + #2}] &, {0}, 2^DigitPositions[t]] DigitPositions[n_] := Flatten[Position[Reverse[IntegerDigits[n, 2]], 1]] - 1 The actual pattern generated by rule 90 corresponds to the coefficients in PolynomialMod[Expand[(1/x + x) t ], 2] (see page 1091 ); the color of a particular cell is thus given by Mod[Binomial[t, (n + t)/2], 2] /; EvenQ[n + t] . … In this pattern, the color of a particular cell can be obtained directly from the digit sequences for t and n by 1 - Sign[BitAnd[-t, n]] or (see page 583 ) With[{d = Ceiling[Log[2, Max[t, n] + 1]]}, If[FreeQ[ IntegerDigits[t, 2, d] - IntegerDigits[n, 2, d], -1], 1, 0]]
Other so-called Fourier series in which the coefficient of Sin[m x] is a smooth function of m for all integer m yield similarly simple results. … Note that for x of the form p π /q , the k = ∞ sum is just ( π /q/(2q)) 2 Sum[Sin[n 2 p π /q]/Sin[n π /(2q)] 2 , {n, q - 1}] The pictures below show Sum[Cos[2 n x], {n, k}] (as studied by Karl Weierstrass in 1872).
Properties of [recursive] sequences Sequence (d) is given by f[n_] := (n + g[IntegerDigits[n, 2]])/2 g[{1 ..}] = 1; g[{1, 0 ..}] = 0 g[{1, s__}] := 1 + g[IntegerDigits[FromDigits[{s}, 2] + 1, 2]] The list of elements in the sequence up to value m is given by Flatten[Table[Table[n, {IntegerExponent[n, 2] + 1}], {n, m}]] The differences between the first 2 (2 k -1) of these elements is Nest[Replace[#, {x___}  {x, 1, x, 0}]&, {}, k] The largest n for which f[n]  m is given by 2m + 1 - DigitCount[m, 2, 1] or IntegerExponent[(2m)!… In the sequences discussed here, f[n_] always has the form f[p[n]] + f[q[n]] . The plots below show p[n] and q[n] as a function of n .
1