Tag：Euclid

Time：20211011
Basic data structure and algorithm of hand golang Euclidean algorithm of maximum common divisor / rolling Division origin Recently read < < my first algorithm book > > ([Japan] Ishida Baohui; Miyazaki Xiuyi)This series of notes is intended to use golang exercises Euclidean algorithm Euclidean algorithm (also known as rolling Division) is used to calculate […]

Time：2020126
Euclidean algorithm The most effective way to find the greatest common factor of two numbers is Euclidean algorithm, which consists of a series of division with remainder until the remainder is zero. Before describing the general method, we use an example to illustrate:We calculategcd(36,132)The first step is132divide36Get quotient3And remainder24。 We write it down as 132 […]

Time：2020125
Theorem of linear equation Likeax+byThe smallest positive integer of is equal togcd(a,b)We use Euclidean algorithm to construct the appropriatexAndyIn other words, the equation will be describedax + by= gcd(a,b)Integer solutionxAndyMethods. Because of each numberax+bycovergcd(a,b)to be divisible by,ax + byThe smallest positive integer value of is exactlygcd(a,b)Solving equations by Euclidean algorithmax+by=gcd(a,b)For example, try to solve the […]

Time：2020123
Now, we know the equation ax+by=gcd(a,b) There is always an integer solutionxAndyHow many solutions are there and how to express them?We are mutually exclusiveaAndbLet gogcd(a,b)=1, assuming(x_1,y_1)It’s an equationax+by=1A solution of. adoptx_1subtractbSum of multiples ofy_1addaOther solutions can be obtained. In other words, for any integerkWe get a new solution(x_1+kb,y_1ka)By calculating a(x_1+kb)+b(y_1ka)=ax_1+akb+by_1bka=ax_1+by_1=1 Still observinggcd(a,b)=1It can be proved […]

Time：201991
This article is a series of articles on the functional programming paradigm, thus opening up and continuing with the followingOne。 introduce In JavaScript, functions are just objects.Therefore, a constructor can be passed as a parameter, returned from a function or assigned to a variable.Therefore, JavaScript hasFirstclass function。More precisely, JavaScript supports the following: Higher order function […]