Math::GrahamFunction - Calculate the Graham's Function of a Natural Number.
Version 0.02000
use Math::GrahamFunction; my $calc = Math::GrahamFunction->new({ 'n' => 500 }); my $results = $calc->solve(); print "The Graham Function of 500 is ", $results->{'factors'}->[-1], "\n";
The Graham Function of a natural number n, which we will denote by G(n), is the minimal number for which there's an increasing series of integers that starts at n and ends at G(n) whose product is a perfect square.
This module calculates the Graham Function of a natural number, along with the entire associated series.
On 11 December 2002, Mark Jason Dominus gave a Perl Quiz-of-the-week challenge to write a Perl program to calculate the Graham Function. I came up with a solution for it, whose complexity was polynomial (as opposed to brute force solutions, which are exponential complexity.). This module is derived from my original code, after it was heavily refactored.
More information about the algorithm and the original code can be found here:
http://www.shlomifish.org/lecture/Perl/Graham-Function/
Initializes a new object for solving the Graham's Function of the number $n. Call solve() next.
$n
Calculates the Graham's Function series for the number (could be time consuming), and returns a hash ref of results. The only field of interest there is 'factors', which points to an array reference of the series. The series is increasing so $results-{factors}->[0]> is $n and $results-{factors}->[-1]} is the Graham's Function.
'factors'
$results-
Get the Square factors of the number $number.
Shlomi Fish, <shlomif at cpan.org>
<shlomif at cpan.org>
The module may yield different sequences with its "factor in between" optimization than without it. The last number (= the Graham function) is the same, but the numbers in between are different. A future release will provide a flag to disable that optimization.
Please report any bugs or feature requests to bug-math-grahamfunction at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Math::GrahamFunction. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-math-grahamfunction at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Math::GrahamFunction
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Math::GrahamFunction
CPAN Ratings
http://cpanratings.perl.org/d/Math::GrahamFunction
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Math::GrahamFunction
Search CPAN
http://search.cpan.org/dist/Math::GrahamFunction
The latest source for this module is available from its subversion repository:
http://svn.berlios.de/svnroot/repos/web-cpan/Math-GrahamFunction/trunk
Mark Jason Dominus ( http://perl.plover.com/ ) for the original Graham Function Quiz-of-the-Week.
imacat (http://www.imacat.idv.tw/) and David Golden for helping me debug a CPAN smoking failure with installing this module on imacat's computer.
Copyright 2007 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.
Note: the module meta-data says this module is released under the BSD license. However, MIT X11 is the more accurate license, and "bsd" is the closest option for the CPAN meta-data.
To install Math::GrahamFunction, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::GrahamFunction
CPAN shell
perl -MCPAN -e shell install Math::GrahamFunction
For more information on module installation, please visit the detailed CPAN module installation guide.