Search NKS | Online

91 - 100 of 113 for Mod
Quadratic residue sequences Mod[Range[n] 2 , n] (see page 1081 ) are used to give profiles for acoustic diffusers that operate uniformly over a range of frequencies.
These values can be found using the so-called Lucas-Lehmer test Nest[Mod[# 2 - 2, 2 n - 1] &, 4, n - 2]  0 , and in all cases n itself must be prime.
Then for the case of rule 60 with n cells and cyclic boundary conditions, the state obtained after t steps is given by PolynomialMod[(1 + x) t z, {x n - 1, 2}] where z is the polynomial representing the initial state, and z = 1 for a single black cell in the first position.
In the usual case, u ⊕ v is just Mod[u+v, k] , yielding say for rule 90 the results below. … And indeed a cellular automaton whose rule is based on Mod[x+y, π ] will show additivity with respect to this operation (see page 922 ).
However, the straightforward method for converting a t -digit number x to base k takes about t divisions, though this can be reduced to around Log[t] by using a recursive method such as FixedPoint[Flatten[Map[If[# < k, #, With[ {e = Ceiling[Log[k, #]/2]}, {Quotient[#, k e ], With[ {s = Mod[#, k e ]}, If[s  0, Table[0, {e}], {Table[0, {e - Floor[Log[k, s]] - 1}], s}]]}]] &, #]] &, {x}] The pictures below show stages in the computation of 3 20 (a) by a power tree in base 2 and (b) by conversion from base 3.
The slightly modified but still very simple scheme Mod[FromDigits[list, k], m] , where m is usually chosen to be a prime, is what is most often used in practice.
The element at position n in the first sequence discussed above can however be obtained in about Log[n] steps using ((IntegerDigits[#3 + Quotient[#1, #2], 2] 〚 Mod[#1, #2] + 1 〛 &)[n - (# - 2)2 # - 1 - 2, #, 2 # - 1 ]&)[NestWhile[# + 1&, 0, (# - 1)2 # + 1 < n &]] where the result of the NestWhile can be expressed as Ceiling[1 + ProductLog[1/2(n - 1)Log[2]]/Log[2]] Following work by Maxim Rytin in the late 1990s about k n+1 digits of a concatenation sequence can be found fairly efficiently from k/(k - 1) 2 - (k - 1) Sum[k (k s - 1) ((1 + s - s k)/(k - 1)) (1/((k - 1) (k s - 1) 2 ) - k/((k - 1) (k s + 1 - 1) 2 ) + 1/(k s + 1 - 1)), {s, n}] Concatenation sequences can also be generated by joining together digits from other representations of numbers; the picture below shows results for the Gray code representation from page 901 .
One set of computations concerned functions f[{w_, x_, y_, z_}] := Mod[w + y + z + x y + x z + y z, 2] (apparently chosen to have balance between 0's and 1's that would minimize correlations).
Continued fractions The first n terms in the continued fraction representation for a number x can be found from the built-in Mathematica function ContinuedFraction , or from Floor[NestList[1/Mod[#, 1]&, x, n - 1]] A rational approximation to the number x can be reconstructed from the continued fraction using FromContinuedFraction or by Fold[(1/#1 + #2 )&, Last[list], Rest[Reverse[list]]] The pictures below show the digit sequences of successive iterates obtained from NestList[1/Mod[#, 1]&, x, n] for several numbers x .
• Is there any x < a such that Mod[x 2 , b]  c ?
1 ... 78910