Posts Tagged ‘Mathematics’

Project Euler : Problem 5

Wednesday, August 4th, 2010

Problem 5 in Project Euler is this:

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

The answer we are looking for is known as the Lowest Common Multiple(LCM), it is the smallest number which is a multiple of all these numbers. (more…)

Project Euler : Problem 4

Monday, August 2nd, 2010

Problem 4 on Project Euler is this:

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 x 99.

(more…)

Project Euler: Problem 3

Sunday, August 1st, 2010

Problem 3 on Project Euler is stated thus:

The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?

(more…)

Checking Prime Numbers

Saturday, July 31st, 2010

Now that we have a function for generating primes, the next library function we will need is to check whether a given number is prime.

The basic method for checking whether a given number n is prime is to use trial division. This involves dividing n by the prime integers from 2 to the square root of n. If any of these divisions result in an integer the number n is not prime, else it is prime. (more…)