# Tag Archives: maths-log

## Logarithm tricks for Competitive Programming

Logarithm: is the inverse function of the exponentiation which means the logarithm value of a given number x is the exponent to another number. Below… Read More »

## Find most significant bit of a number X in base Y

Given two positive integers X and Y, the task is to find the MSB of X, in the given base Y. Examples: Input: X =… Read More »

## Highest power of 2 less than or equal to given Integer

Given an integer N, the task is to find the highest power of 2 that is smaller than or equal to N. Examples: Input: N… Read More »

## Program to compute log a to any base b (logb a)

Given two integers a and b, the task is to find the log of a to any base b, i.e. logb a. Examples: Input: a… Read More »

## Find the value of ln(N!) using Recursion

Given a number N, the task is to find the log value of the factorial of N i.e. log(N!). Note: ln means log with base… Read More »

## Logarithm

Logarithmic function is the inverse to the exponential function. A logarithm to the base b is the power to which b must be raised to… Read More »

## Larger of a^b or b^a (a raised to power b or b raised to power a)

Given two numbers , find which is greater . If , print a^b is greater If , print b^a is greater If , print Both… Read More »

## Check if any permutation of N equals any power of K

Given a positive integer N and K where and . The task is to check whether any permutation of digits of N equals any power… Read More »

## Find the total Number of Digits in (N!)N

Given a number N. The task is to find the total Number of Digits in . Examples: Input: N = 3 Output: 3 If N=3,… Read More »

## Check if a number can be expressed as a^b | Set 2

You have given a number n. Check if a number can be represented in the form of pow(a, b) (a^b). Examples: Input : 4 Output… Read More »

## Find minimum number of Log value needed to calculate Log upto N

Given an integer N. The task is to find the minimum number of log values needed to calculate all the log values from 1 to… Read More »

## Print all substring of a number without any conversion

Given an integer N, the task is to print all the substring of N without doing any conversion i.e converting it into a string or… Read More »

## Find maximum among x^(y^2) or y^(x^2) where x and y are given

Given X and Y whose values are greater than 2, the task is to find out which is maximum among x^(y^2) and y^(x^2) Consider that… Read More »

## Divide two integers without using multiplication, division and mod operator | Set2

Given two integers say a and b. Find the quotient after dividing a by b without using multiplication, division and mod operator. Examples: Input: a… Read More »

## Program to compare m^n and n^m

Given two positive integers m and n, the task is to write a program that checks whether m^n is greater than, less than or equal… Read More »