Skip to main content

Posts

Showing posts from October, 2020

Jagged Number

A k-rough or k-jagged number is a number whose smallest prime factor is greater than or equal to the number ‘k’. Given numbers ‘n’ and ‘k’ as input, we are required to find whether ‘n; is a k-rough number or not.

Frugal Number

A frugal number is a number whose number of digits is strictly greater than the number of digits in its prime factorization (including exponents). If the exponent is 1 for a certain prime, involved in the prime factorization, then that exponent does not contribute to the number of digits in the prime factorization.

Blum Integer

Blum Integer is the number which only haves 2 factors suppose p and q (i.e. n = p * q), both are Semi-prime and also they(p and q) are of the form 4t + 3, where t is some integer. First few Blum Integers are 21, 33, 57, 69, 77, 93, 129, 133, 141, 161, 177, … Note: Because of the condition that both the factors should be semi-primes, even numbers can not be Blum integers neither can be the numbers below 20, So we have to check only for an odd integer greater than 20 that if it is a Blum Integer or not.

Lemoine’s Conjecture

Any odd integer greater than 5 can be expressed as a sum of an odd prime (all primes other than 2 are odd) and an even semiprime. A semiprime number is a product of two prime numbers. This is called Lemoine’s conjecture.

Betrothed numbers

Betrothed numbers are two positive numbers such that the sum of the proper divisors of either number is one more than (or one plus) the value of the other number. Our task is to find these pairs efficiently.

Aliquot Sum

In number theory, the aliquot sum s(n) of a positive integer n is the sum of all proper divisors of n, that is, all divisors of n other than n itself. They are defined by the sums of their aliquot divisors. The aliquot divisors of a number are all of its divisors except the number itself. The aliquot sum is the sum of the aliquot divisors so, for example, the aliquot divisors of 12 are 1, 2, 3, 4, and 6 and it’s aliquot sum is 16.

Fermat's Last Theorem

According to Fermat’s Last Theorem, no three positive integers a, b, c satisfy the equation, a^n + b^n = c^n for any integer value of n greater than 2. For n = 1 and n = 2, the equation have infinitely many solutions.

Hosoya’s Triangle

The Fibonnaci triangle or Hosoya’s triangle is a triangular arrangement of numbers based on Fibonacci numbers. Each number is the sum of two numbers above in either the left diagonal or the right diagonal.

Dyck Path

Consider a n x n grid with indexes of top left corner as (0, 0). Dyck path is a staircase walk from bottom left, i.e., (n-1, 0) to top right, i.e., (0, n-1) that lies above the diagonal cells (or cells on line from bottom left to top right). The task is to count the number of Dyck Paths from (n-1, 0) to (0, n-1)

CPCoders

This website is brought to you by CPCoders.We are working on Competitive Coding Algortihm Libraries for JavaScript. We are currently developing cpmath and cpcodes libraries.

Karatsuba

The Karatsuba algorithm is a fast multiplication algorithm. It was discovered by Anatoly Karatsuba in 1960 and published in 1962.For example, the Karatsuba algorithm requires 310 = 59,049 single-digit multiplications to multiply two 1024-digit numbers (n = 1024 = 210), whereas the traditional algorithm requires (210)2 = 1,048,576 (a speedup of 17.75 times). The Karatsuba algorithm was the first multiplication algorithm asymptotically faster than the quadratic "grade school" algorithm. The Toom–Cook algorithm (1963) is a faster generalization of Karatsuba's method, and the Schönhage–Strassen algorithm (1971) is even faster, for sufficiently large n.

Euclidean GCD

In mathematics, the Euclidean algorithm, or Euclid's algorithm, is an efficient method for computing the greatest common divisor (GCD) of two integers (numbers), the largest number that divides them both without a remainder. It is named after the ancient Greek mathematician Euclid, who first described it in his Elements (c. 300 BC). It is an example of an algorithm, a step-by-step procedure for performing a calculation according to well-defined rules, and is one of the oldest algorithms in common use. It can be used to reduce fractions to their simplest form, and is a part of many other number-theoretic and cryptographic calculations.

Diophantine

In mathematics, a Diophantine equation is a polynomial equation, usually in two or more unknowns, such that only the integer solutions are sought or studied (an integer solution is such that all the unknowns take integer values). A linear Diophantine equation equates the sum of two or more monomials, each of degree 1 in one of the variables, to a constant. An exponential Diophantine equation is one in which exponents on terms can be unknowns.

Euler's totient

In number theory, Euler's totient function counts the positive integers up to a given integer n that are relatively prime to n. It is written using the Greek letter phi as φ(n) or Ï•(n), and may also be called Euler's phi function. In other words, it is the number of integers k in the range 1 ≤ k ≤ n for which the greatest common divisor gcd(n, k) is equal to 1.[2][3] The integers k of this form are sometimes referred to as totatives of n. For example, the totatives of n = 9 are the six numbers 1, 2, 4, 5, 7 and 8. They are all relatively prime to 9, but the other three numbers in this range, 3, 6, and 9 are not, since gcd(9, 3) = gcd(9, 6) = 3 and gcd(9, 9) = 9. Therefore, φ(9) = 6. As another example, φ(1) = 1 since for n = 1 the only integer in the range from 1 to n is 1 itself, and gcd(1, 1) = 1. function euler_totient(n) { //Logic phi = new Array(n + 1).fill(1); phi[0] = 0; for(var i = 2; i <= n; i++) { phi[i] = i; } for(var i = 2; i <= n;

ZFunction

In mathematics, the Z function is a function used for studying the Riemann zeta function along the critical line where the argument is one-half. It is also called the Riemann–Siegel Z function, the Riemann–Siegel zeta function, the Hardy function, the Hardy Z function and the Hardy zeta function. It can be defined in terms of the Riemann–Siegel theta function and the Riemann zeta functionIt follows from the functional equation of the Riemann zeta function that the Z function is real for real values of t. It is an even function, and real analytic for real values. It follows from the fact that the Riemann-Siegel theta function and the Riemann zeta function are both holomorphic in the critical strip, where the imaginary part of t is between −1/2 and 1/2, that the Z function is holomorphic in the critical strip also. Moreover, the real zeros of Z(t) are precisely the zeros of the zeta function along the critical line, and complex zeros in the Z function critical strip correspond to zeros o

stein_gcd

The binary GCD algorithm, also known as Stein's algorithm, is an algorithm that computes the greatest common divisor of two nonnegative integers. Stein's algorithm uses simpler arithmetic operations than the conventional Euclidean algorithm; it replaces division with arithmetic shifts, comparisons, and subtraction.

nCrModPFermat

Fermat's little theorem states that if p is a prime number, then for any integer a, the number a p – a is an integer multiple of p. ap ≡ a (mod p). Special Case: If a is not divisible by p, Fermat's little theorem is equivalent to the statement that a p-1-1 is an integer multiple of p. Here a is not divisible by p. We will use this theorem to find nCr.

Pollard's Rho

Pollard's rho algorithm is an algorithm for integer factorization. It was invented by John Pollard in 1975. It uses only a small amount of space, and its expected running time is proportional to the square root of the size of the smallest prime factor of the composite number being factorized.The algorithm takes as its inputs n, the integer to be factored; and g(x), a polynomial in x computed modulo n.The output is either a non-trivial factor of n, or failure

Dixon's Factorization

In number theory, Dixon's factorization method (also Dixon's random squares method or Dixon's algorithm) is a general-purpose integer factorization algorithm; it is the prototypical factor base method. Unlike for other factor base methods, its run-time bound comes with a rigorous proof that does not rely on conjectures about the smoothness properties of the values taken by polynomial. The algorithm was designed by John D. Dixon, a mathematician at Carleton University, and was published in 1981.

Rencontres Number

In combinatorial mathematics, the rencontres numbers are a triangular array of integers that enumerate permutations of the set { 1, ..., n } with specified numbers of fixed points: in other words, partial derangements. (Rencontre is French for encounter. By some accounts, the problem is named after a solitaire game.) For n ≥ 0 and 0 ≤ k ≤ n, the rencontres number Dn, k is the number of permutations of { 1, ..., n } that have exactly k fixed points. For example, if seven presents are given to seven different people, but only two are destined to get the right present, there are D7, 2 = 924 ways this could happen. Another often cited example is that of a dance school with 7 couples, where, after tea-break the participants are told to randomly find a partner to continue, then once more there are D7, 2 = 924 possibilities that 2 previous couples meet again by chance.

Leornado Number

The Leonardo numbers are a sequence of numbers given by the recurrence: Edsger W. Dijkstra used them as an integral part of his smoothsort algorithm, and also analyzed them in some detail.