Important Definitions and Concepts from Mathematics and Probability for Solving Coding Problems
Fibonacci numbers or Fibonacci sequence
In mathematics, the Fibonacci numbers or Fibonacci sequence are the numbers in the following integer sequence:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55...
- It may start from 0 or 1.
- Every element is the sum of previous two elements.
- The Fibonacci sequence is named after Italian mathematician Fibonacci.
Factorial
In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,
5! = 5 * 4 * 3 * 2 * 1 = 120.
- 0! is 1.
- The notation n! was introduced by Christian Kramp in 1808.
Prime and Composite numbers
- A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself.
- A natural number greater than 1 that is not a prime number is called a composite number.
- For example, 5 is prime because 1 and 5 are its only positive integer factors, whereas 6 is composite because it has the divisors 2 and 3 in addition to 1 and 6.
- The property of being prime (or not) is called primality.
- A simple but slow method of verifying the primality of a given number n is known as trial division. It consists of testing whether n is a multiple of any integer between 2 and sqrt{n}.
- The Sieve of Eratosthenes is a simple algorithm for finding all prime numbers up to a specified integer.
The first 25 prime numbers (all the prime numbers less than 100) are:
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97.
- admin's blog
- Log in or register to post comments