Basic mathematical algorithms
Next
Basic data structures >| |
The algorithm is a specification of the steps to be followed to solve a problem in the final step. Algorithms are very close to computer programs, and sometimes they identify with them. The algorithm, however, can describe many procedures that will never be executed on a computer.
Many of the algorithms used today in computer programs have been created long before the creation of a computer. The Euclidean algorithm for determining the greatest common divisor (GCD) is known for two integers:
Let the greatest common divisor of integers m and n be found. (This is the largest number that divides without residue and both numbers.) If m> n, we need to split m with n and let r be the rest of the division. If r = 0 then the solution is n; otherwise, the same algorithm should be repeated with n and r. This algorithm is based on the fact that if some number divides without residue the numbers m and n, m> n, then this same number divides without residue and the numbers n and r, where r is the remainder of the division m with n, which can be formally shown.
Many of the algorithms used today in computer programs have been created long before the creation of a computer. The Euclidean algorithm for determining the greatest common divisor (GCD) is known for two integers:
Let the greatest common divisor of integers m and n be found. (This is the largest number that divides without residue and both numbers.) If m> n, we need to split m with n and let r be the rest of the division. If r = 0 then the solution is n; otherwise, the same algorithm should be repeated with n and r. This algorithm is based on the fact that if some number divides without residue the numbers m and n, m> n, then this same number divides without residue and the numbers n and r, where r is the remainder of the division m with n, which can be formally shown.
Array of Fibonacci |
Prime numbers and factoring |
Sieve of Eratosthenes |
The Euclidean algorithm |
These numbers have a great application in nature. The number of petals on the flower, the number of spirals on the sunflower, the hive, the hive, the leaves on the branch, the shell of the snail Nautilus is a typical Fibonacci series.
|
For some natural number we say that it is simple, if it is only divisible by 1 and with itself. -
|
Eratosthenes sieve is an algorithm that helps to quickly solve the following problem:
For a given natural number, n determine all the free numbers in the segment of [1, n]. |
The Euclidean algorithm was named after the Greek mathematician Euclid and is used to effectively determine the largest common divisor
|
Determining the maximum sum of a consecutive subsequenceDetermination of the maximum amount of consecutive submission. A problem that often arises in computational biology when analyzing DNA or protein sequences.
|