Top "Math" questions

Math involves the manipulation of numbers within a program.

Fastest way to determine if an integer's square root is an integer

I'm looking for the fastest way to determine if a long value is a perfect square (i.e. its square …

java math optimization perfect-square
Is there a math nCr function in python?

Possible Duplicates: Statistics: combinations in Python counting combinations and permutations efficiently Project euler problem in python (problem 53) I'm looking to …

python function math
How do I calculate a point on a circle’s circumference?

How can the following function be implemented in various languages? Calculate the (x,y) point on the circumference of a …

algorithm math trigonometry
Easy interview question got harder: given numbers 1..100, find the missing number(s) given exactly k are missing

I had an interesting job interview experience a while back. The question started really easy: Q1: We have a bag …

algorithm math
How to calculate mean, median, mode and range from a set of numbers

Are there any functions (as part of a math library) which will calculate mean, median, mode and range from a …

java math probability
How to create the most compact mapping n → isprime(n) up to a limit N?

Naturally, for bool isprime(number) there would be a data structure I could query. I define the best algorithm, to …

algorithm math data-structures primes
How to check if a number is a power of 2

Today I needed a simple algorithm for checking if a number is a power of 2. The algorithm needs to be: …

c# algorithm math
How to scale down a range of numbers with a known min and max value

So I am trying to figure out how to take a range of numbers and scale the values down to …

math range scaling max minimum
How to expand and compute log(a + b)?

I would like to know the complete expansion of log(a + b). For example log(a * b) = log(a) + log(…

math logarithm
How to determine if a point is in a 2D triangle?

Is there an easy way to determine if a point is inside a triangle? It's 2D, not 3D.

algorithm math geometry