Search NKS | Online
51 - 60 of 113 for Mod
The particular rule used here can be described by the formula a i '= Mod[a i-1 + a i+1 , 2] .
The value of the cell at position n from the end of row t is thus the n th digit of m t , or Mod[Quotient[m t , k n ], k] .
Defining
PM[s_] := IntegerDigits[Range[2 s - 1], 2, s]
blocks of data of length m can be encoded with
Join[data, Mod[data . Select[PM[s], Count[#, 1] > 1 &], 2]]
while blocks of length n (and at most one error) can be decoded with
Drop[(If[# 0, data, MapAt[1 - # &, data, #]] &)[ FromDigits[Mod[data .
LFSR cryptanalysis
Given a sequence obtained from a length n LFSR (see page 975 )
Nest[Mod[Append[#, Take[#, -n] . vec], 2] &, list, t]
the vector of taps vec can be deduced from
LinearSolve[Table[Take[seq, {i, i + n - 1}], {i, n}], Take[seq, {n + 1, 2n}], Modulus 2]
(An iterative algorithm in n taking about n 2 rather than n 3 steps was given by Elwyn Berlekamp and James Massey in 1968.)
The arithmetic system takes the value n that it obtains at each step, computes Mod[n, 30] , and then depending on the result applies to n one of the arithmetic operations specified by the rule above.
The pictures on the right below show Sin[1/2 π a[t, n]] 2 for these functions (equivalent to Mod[a[t, n], 2] for integer a[t, n] ).
Cyclic addition
After t steps, the dot will be at position Mod[m t, n] where n is the total number of positions, and m is the number of positions moved at each step.
The number with run lengths corresponding to successive integers (so that the n th digit is Mod[Floor[1/2 + Sqrt[2n]], 2] ) turns out to be (1 - 2 1/4 EllipticTheta[2, 0, 1/2] + EllipticTheta[3, 0, 1/2])/2 , and appears at least not to be algebraic.
Equivalential calculus
Expressions with variables vars are equivalent if they give the same results for
Mod[Map[Count[expr, #, {-1}] &, vars], 2]
With n variables, there are thus 2 n equivalence classes of expressions (compared to 2 2 n for ordinary logic).
Second-order cellular automata
Second-order elementary rules can be implemented using
CA2EvolveList[rule_List, {a_List, b_List}, t_Integer] := Map[First, NestList[CA2Step[rule, #]&, {a, b}, t]]
CA2Step[rule_List, {a_, b_}] := {b, Mod[a + rule 〚 8 - (RotateLeft[b] + 2 (b + 2 RotateRight[b])) 〛 , 2]}
where rule is obtained from the rule number using IntegerDigits[n, 2, 8] .