# Category Archives: Mathematical

## Ways to express a number as product of two different factorsOctober 16, 2017

Given a number n, write a program to calculate number of ways in which number can be expressed as product of two different factors. Examples:… Read More »

## Count divisors of n that have at-least one digit common with n

Given an number n, find the number of divisors whose at least one digit in the decimal representation matches with the number n. Examples: Input… Read More »

## Doolittle Algorithm : LU DecompositionOctober 15, 2017

In numerical analysis and linear algebra, LU decomposition (where ‘LU’ stands for ‘lower upper’, and also called LU factorization) factors a matrix as the product… Read More »

## Divide number into two parts divisible by given numbers

Given a large number in string format and we are also given two numbers f and s. We need to divide the large number into… Read More »

## Least Common Denominator (LCD)October 14, 2017

The lowest Common Denominator or Least Common Denominator is the Least Common Multiple of the denominators of a set of fractions. Common denominator : when… Read More »

## Vampire NumberOctober 12, 2017

Introduction to Vampire Number and its implementation using python. Introduction In mathematics, a vampire number (or true vampire number) is a composite natural number v,… Read More »

## Count of numbers satisfying m + sum(m) + sum(sum(m)) = N

Given an integer N, find out the count of numbers(m) that satisfy the condition m + sum(m) + sum (sum(m)) = N, where sum(m) denotes… Read More »

## GCD of digits of a given number

Given a number n, find GCD of its digits. Examples: Input : 345 Output : 1 GCD of 3, 4 and 5 is 1. Input… Read More »

## Check if a number is power of k using base changing method

This program checks whether a number n can be expressed as power of k and if yes, then to what power should k be raised… Read More »

## Check if number is palindrome or not in OctalOctober 11, 2017

Given a number which may be in octal or in decimal. If the number is not octal then convert it into octal then check if… Read More »

## Find all factorial numbers less than or equal to n

A number N is called a factorial number if it is the factorial of a positive integer. For example, the first few factorial numbers are… Read More »

## Happy NumbersOctober 10, 2017

A Happy Number n is defined by the following process. Starting with n, replace it with the sum of the squares of its digits, and… Read More »

## N expressed as sum of 4 prime numbers

Express a given number as a summation of 4 positive primes. If it is not possible to express then print “-1”. Examples: Input: 24 Output:… Read More »

## Program to find Sum of a Series a^1/1! + a^2/2! + a^3/3! + a^4/4! +…….+ a^n/n!October 9, 2017

Given two values ‘a’ and ‘n’, find sum of series a^1/1! + a^2/2! + a^3/3! + a^4/4! +…….+ a^n/n!. Input : a = 2 and… Read More »

## Check whether a number has exactly three distinct factors or not

Given a positive integer n(1 <= n <= 1018). Check whether a number has exactly three distinct factors or not. Print “Yes” if it has… Read More »