The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Project::Euler::Problem::P002

VERSION

Version v0.1.0

SYNOPSIS

This module is used to solve problem #2 located on projecteuer.net

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 numbers that are used to filter out the fib numbers

    Default: 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

    4613732

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 positive digit

Solve the problem (internal function)

Use Math::Big to find all of the fib numbers, filter them, then 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.