Check whether a given Number is Power-Isolated or not
Given a integer N, with prime factorisation n1p1 * n2p2 …… The task is to check if the integer N is power-isolated or not....
read more
Ternary number system or Base 3 numbers
A number system can be considered as a mathematical notation of numbers using a set of digits or symbols. In simpler words, the number system is a method of representing numbers. Every number system is identified with the help of its base or radix....
read more
C/C++ program for Armstrong Numbers
...
read more
Maximize trailing zeros in product from top left to bottom right of given Matrix
Given a matrix mat[][] of dimensions N * M, the task is to print the maximum number of trailing zeros that can be obtained in the product of matrix elements in the path from the top-left cell (0, 0) to the bottom-right cell (N – 1, M – 1) of the given matrix. Only possible moves from any cell (i, j) is (i + 1, j) or (i, j + 1)....
read more
Vantieghems Theorem for Primality Test
Vantieghems Theorem is a necessary and sufficient condition for a number to be prime. It states that for a natural number n to be prime, the product of where , is congruent to . In other words, a number n is prime if and only if....
read more
Make elements of Array equal by repeatedly dividing elements by 2 or 3
Given an integer array A consisting of N integers. In one move, we can choose any index i ( 0 ≤ i ≤ N-1) and divide it either by 2 or 3(the number A[i] should be divisible by 2 or 3, respectively), the task is to find the minimum number of total moves required such that all array elements are equal. If it is not possible to make all elements equal, print -1....
read more
Brahmagupta Fibonacci Identity
Brahmagupta Fibonacci identity states that the product of two numbers each of which is a sum of 2 squares can be represented as sum of 2 squares in 2 different forms....
read more
Counting numbers with given digits and digit sum
Given a number N, count the numbers X of length exactly N such that the number X and the sum of digits of the number X have digits A and B only in their decimal representation. The length of a number is defined as the number of digits in its decimal representation without leading zeroes....
read more
Check if given number can be represented as sum of two great numbers
We are given a number N. We need to check if the given number N can be represented as sum of two Great numbers. If yes then print those two great numbers else print no. Great numbers are those which are represented in the form : ((b)*(b+1)*(2*b+1))/6 where b is a natural number. Examples:...
read more
Fermat’s Last Theorem
According to Fermat’s Last Theorem, no three positive integers a, b, c satisfy the equation, for any integer value of n greater than 2. For n = 1 and n = 2, the equation have infinitely many solutions....
read more
Convert given Float value to equivalent Fraction
Given a floating-point number in the form of a string N, the task is to convert the given floating-point number into fractions....
read more
Eulerian Number
In combinatorics, the Eulerian Number A(n, m), is the number of permutations of the numbers 1 to n in which exactly m elements are greater than previous element....
read more