Adam Lesperance >
Project-Euler-0.20 >
Project::Euler::Problem::P005

Module Version: 0.20
Project::Euler::Problem::P005 - Solutions for problem 005 - Least common multiple

version 0.20

http://projecteuler.net/index.php?section=problems&id=5

use Project::Euler::Problem::P005; my $p5 = Project::Euler::Problem::P005->new; my $default_answer = $p5->solve;

This module is used to solve problem #005

Use Math::BigInt to calculate the least common multiple between numbers

005

Least common multiple

30 November 2001

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 number that is evenly divisible by all of the numbers from 1 to 20?

20

232792560

Yes

The input controls the cap of the range of numbers to find the least common multiple of.

The restrictions on custom_input

A positve integer

This is just goes from the largest multi_num until multiple_check returns true and returns that number.

This is like P3 in that it's definitely cheating and will have to be re-written with custom logic (even though it will almost certainly be much slower)

Adam Lesperance <lespea@gmail.com>

This software is copyright (c) 2010 by Adam Lesperance.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: