• ## Basic data structure and algorithm of hand golang Euclidean algorithm of maximum common divisor / rolling Division

Time：2021-10-11

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 […]

• ## Chapter 5: divisibility and the greatest common factor (2)

Time：2020-12-6

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 […]

• ## Chapter 6: linear equations and the greatest common factor (1)

Time：2020-12-5

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 […]

• ## Chapter 6: linear equations and the greatest common factor (2)

Time：2020-12-3

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_1-ka)By calculating a(x_1+kb)+b(y_1-ka)=ax_1+akb+by_1-bka=ax_1+by_1=1 Still observinggcd(a,b)=1It can be proved […]

• ## Discussing functional programming in JavaScript through algebra, numbers, Euclidean planes and Fractals

Time：2019-9-1

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 hasFirst-class function。More precisely, JavaScript supports the following: Higher order function […]