Other Stuff
Friday
Aug242012

Wednesday
Jun062012

Saturday
Jun022012

Wednesday
May092012

Project Euler - Problem 5

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

This was a neat question could be brute forced easily but that would be very slow. There is a table method which exploits the properties of prime numbers to find least common multiple of a set of numbers. The exact method can be found on the least common multiple wikipedia page

Saturday
May052012

Project Euler - Problem 4

Find the largest palindrome made from the product of two 3-digit numbers.

A palindrome is a string which reads the same forwards and backwards for example 98789. The isPalinedrome(x) method checks if x is a palindrome by checking if x equals x in reverse. The n[::-1] call returns the reverse of n. The stride notation lets you filter in a interval of elements in a list. For example the call n[::2] for n = [1,2,3,4]   would return [2,4]. Then a nested for loop is used to find the biggest palindrome made of the product 3 digit integers.

Page 1 2 3 4 5 ... 26