Wilson’s theorem states that a natural number p > 1 is a prime number if and only if (p - 1) ! ≡ -1 mod… Read More

# Category Archives: Mathematical

What is rank of a matrix? Rank of a matrix A of size M x N is defined as (a) Maximum number of linearly independent… Read More

Given an array arr[] of size n and integer k such that k <= n. Examples : Input: arr[] = {3, 7, 90, 20, 10,… Read More

Given a number n, check if it is prime or not. We have introduced and discussed School and Fermat methods for primality testing.Primality Test |… Read More

We are given two arrays num[0..k-1] and rem[0..k-1]. In num[0..k-1], every pair is coprime (gcd for every pair is 1). We need to find minimum… Read More

We are given two numbers x and y. We know that a number p divides their product. Can we say for sure that p also… Read More

We are given two arrays num[0..k-1] and rem[0..k-1]. In num[0..k-1], every pair is coprime (gcd for every pair is 1). We need to find minimum… Read More

Given three numbers n, r and p, compute value of nCr mod p.Examples: Input: n = 10, r = 2, p = 13 Output: 6… Read More

Given three numbers n, r and p, compute value of nCr mod p. Example: Input: n = 10, r = 2, p = 13 Output: 6… Read More

Sets are a type of associative containers in which each element has to be unique, because the value of the element identifies it. The… Read More

Fibonacci coding encodes an integer into binary number using Fibonacci Representation of the number. The idea is based on Zeckendorf’s Theorem which states that every… Read More

Given a digit ‘d’ and a range [L, R] where L < R, print all good numbers in given range that don't contain digit 'd'.… Read More

Given a m x n rectangle, how many squares are there in it? Examples : Input: m = 2, n = 2 Output: 5 There… Read More

Zeckendorf’s theorem states that every positive integer can be written uniquely as a sum of distinct non-neighbouring Fibonacci numbers. Two Fibonacci numbers are neighbours if… Read More

Given a positive integer n, find number of ways to divide n in four parts or represent n as sum of four positive integers. Here… Read More