NAME
Project::Euler::Problem::P001 - Solutions for problem 001 projecteuler.net
VERSION
Version 0.10
SYNOPSIS
This module is used to solve problem #001 located on projecteuer.net
This simple problem simply needs to find the sum of all the numbers within a range which are multiples of a set of integers. The range always starts at 1 and continues upto $self->max_number
(1000 by default). The set of numbers is stored in $self->multi_nums
.
Problem Attributes
Multiple Numbers
An array of numbers that are used to filter out the integers to sum
Default: 3 & 5
SETUP
Problem Number
001
Problem Name
Sum filtered list
Problem Date
2001-10-05
Problem Desc
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
Default Input
The maximum value: 1,000
Default Answer
233168
Has Input?
Yes
Help Message
You can set max_number and multi_nums to alter the way the program will function. Don't forget to specify the wanted_answer if you know it!
FUNCTIONS
Validate Input (internal function)
The input must must be formatted like this:
A positve integer
Solve the problem (internal function)
Tell the multiple_check object what the current multi_nums is. Then loop from the first multi_num to the max_number (- 1) and filter all numbers that retrun false. Finally use the List::More util 'sum' to return the sum of the filtered numbers. If nothing was found return 0 rather than undef!
AUTHOR
Adam Lesperance, <lespea at cpan.org>
BUGS
Please report any bugs or feature requests to bug-project-euler at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Project-Euler. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Project::Euler::Problem::P001
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2009 Adam Lesperance.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.