Category Archives: Math and Probability

Python Power Function

Syntax The power function in Python can be easily computed by importing the math module as follows: import math # This will print 8 which is 2 to the power 3 print pow(2, 3) You can alternatively use the ** …

Read more »

Amicable Numbers

Amicable Numbers Definition Two positive integer numbers (m, n) are amicable if the sum of the proper divisors of (m) is equal to (n) and the sum of the proper divisors of (n) is equal to (m). A proper divisor …

Read more »

NP Complete Problems

Introduction One of the – confusing – topics in Algorithm design is the concept of NP completeness. If you search the topic on the internet you will probably find tons of articles and lectures on the subject however in this …

Read more »

Playing Cards – Four of a Kind

Problem 5 cards are randomly drawn from a standard 52 card deck. What is the probability to get four of a kind. For example 4 different aces plus some additional card Solution The total number of ways to choose 5 …

Read more »

Computer Language Symbols

Problem A computer language is usingĀ 10 symbols and 26 letters. How many 6 digit words can be constructed using 3 different letters and 3 different symbols. How many different symbols can be constructed if the word has to start with …

Read more »

Probability of Selecting Two Balls of the Same Color

Problem You have 6 red balls, 7 green balls and 4 blue balls. You are asked to choose two balls. How many different ways you can select the balls if the color should match. How many different ways you can …

Read more »

Men and Women

Problem How many different couples we can make if we are asked to select 5 women from 10 candidates and 5 men from 12 candidates. Solution There are 10 choose 5 different ways to select the women: 10!/(10-5)!5! = 252 …

Read more »

Page 1 of 3123