Calculate nCr using Pascal’s Triangle

A useful application of Pascal’s triangle is the calculation of combinations. The formula to find nCr is n! / r! * (n – r)! which… Read More »

Count the number of special permutations

Given two positive integers n and k, the task is to count the number of special permutations. A special permutation P is defined as a… Read More »

Ways of selecting men and women from a group to make a team

Given four integers n, w, m and k where, m is the total number of men. w is the total number of women. n is… Read More »

Ways of dividing a group into two halves such that two elements are in different groups

Given 2n girls and randomly divided into two subgroups each containing n girls. The task is to count the number of ways in which groups… Read More »

Program to find the value of sin(nΘ)

Given the value of sin(Θ) and a variable n<=15. The task is to find the value of sin(nΘ) using propety of trignometric functions. Examples: Input:… Read More »

Program to find the value of tan(nΘ)

Given a value of tan(Θ) and a variable n <=15. The task is to find the value of tan(nΘ) using property of trignometric functions. Examples:… Read More »

Program to Find the value of cos(nΘ)

Given a value of cos(Θ) and a variable . The task is to find the value of cos(nΘ) using propety of trignomertric functions. Note: n… Read More »

Eggs dropping puzzle (Binomial Coefficient and Binary Search Solution)

Given n eggs and k floors, find the minimum number of trials needed in worst case to find the floor below which all floors are… Read More »

Queries of nCr%p in O(1) time complexity

Given Q queries and P where P is a prime number, each query has two numbers N and R and the task is to calculate… Read More »

beta(), betaf() and betal() functions in C++ STL

The beta(), betaf() and betal() are built-in functions in C++ STL that are used to compute the beta functionof two positive real values. The function… Read More »

Sum of product of consecutive Binomial Coefficients

Given a positive ineteger n. The task is to find the sum of product of consecutive binomial coefficient i.e nC0*nC1 + nC1*nC2 + ….. +… Read More »

Sum of product of r and rth Binomial Coefficient (r * nCr)

Given a positive integer n. The task is to find the sum of the product of r and rth Binomial Coefficient. In other words find:… Read More »

Corollaries of Binomial Theorem

The expression denotes times. This can be evaluated as the sum of the terms involving for k = 0 to n, where the first term… Read More »

Pentatope number

Given a number n, find the nth Pentatope number. A pentatope number is represented by the fifth number in any row of Pascal’s Triangle. As… Read More »

Middle term in the binomial expansion series

Given three integers A, X, and n. The task is to find the middle term in the binomial expansion series. Examples: Input : A =… Read More »