NAME
Project::Euler::Problem::P002 - Solutions for problem 002
VERSION
Version v0.1.2
SYNOPSIS
http://projecteuler.net/index.php?section=problems&id=2
use Project::Euler::Problem::P002;
my $p2 = Project::Euler::Problem::P002->new;
my $default_answer = $p2->solve;
DESCRIPTION
This module is used to solve problem #002
This is a simple problem which computes the fib numbers upto a certain maximum and sums all of them that are even (or as implemented here, divisible by every multi_nums)
Problem Attributes
Multiple Numbers
An array of positive numbers that are used to filter out the fib numbers
[2]
SETUP
Problem Number
002
Problem Name
Sum filtered fib numbers
Problem Date
2001-10-19
Problem Desc
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
Find the sum of all the even-valued terms in the sequence which do not exceed four million.
Default Input
Max number to go up to: 4,000,000
Default Answer
4,613,732
Has Input?
Yes
Help Message
You can change multi_nums
to alter the way the program will function. If you are providing custom_input, don't forget to specify the wanted_answer if you know it!
INTERNAL FUNCTIONS
Validate Input
The restrictions on custom_input
A positive integer
Solving the problem
Use Math::Big to find fib numbers upto $max, filter them, and find the sum
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::P002
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.