Search NKS | Online
1 - 4 of 4 for ExtendedGCD
Given the horizontal and vertical positions x and y a square is white when GCD[x, y] 1 and is black otherwise. The condition GCD[x, y] 1 is equivalent to the statement that x and y are relatively prime, or that no reduction is required to bring the fraction x/y to lowest terms. It can be shown that if the pattern is extended sufficiently far, then any possible local arrangement of black squares will eventually appear—though not necessarily with equal frequency.
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]] .
Linear Diophantine equations such as a x b y + c yield simple repetitive results, as in the pictures below, and can be handled essentially just by knowing ExtendedGCD[a, b] .
Diophantine equations
If variables appear only linearly, then it is possible to use ExtendedGCD (see page 944 ) to find all solutions to any system of Diophantine equations—or to show that none exist.