NAME
Math::GrahamFunction - Calculate the Graham's Function of a Natural Number.
VERSION
version 0.02003
SYNOPSIS
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";
DESCRIPTION
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.
BACKGROUND
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/
FUNCTIONS
my $calc = Math::GrahamFunction->new({'n' => $n});
Initializes a new object for solving the Graham's Function of the number $n
. Call solve() next.
my $results = $calc->solve();
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.
$self->_get_num_facts($number)
Get the Square factors of the number $number.
AUTHOR
Shlomi Fish, <shlomif at cpan.org>
KNOWN BUGS
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.
BUGS
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.
SUPPORT
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
CPAN Ratings
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Math::GrahamFunction
Search CPAN
SOURCE AVAILABILITY
The latest source for this module is available from its subversion repository:
http://svn.berlios.de/svnroot/repos/web-cpan/Math-GrahamFunction/trunk
ACKNOWLEDGEMENTS
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 & LICENSE
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.
AUTHOR
Shlomi Fish <shlomif@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2019 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
BUGS
Please report any bugs or feature requests on the bugtracker website https://github.com/shlomif/perl-math-grahamfunction/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
SUPPORT
Perldoc
You can find documentation for this module with the perldoc command.
perldoc Math::GrahamFunction
Websites
The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
Search CPAN
The default CPAN search engine, useful to view POD in HTML format.
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
https://rt.cpan.org/Public/Dist/Display.html?Name=Math-GrahamFunction
AnnoCPAN
The AnnoCPAN is a website that allows community annotations of Perl module documentation.
CPAN Ratings
The CPAN Ratings is a website that allows community ratings and reviews of Perl modules.
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
Bugs / Feature Requests
Please report any bugs or feature requests by email to bug-math-grahamfunction at rt.cpan.org
, or through the web interface at https://rt.cpan.org/Public/Bug/Report.html?Queue=Math-GrahamFunction. You will be automatically notified of any progress on the request by the system.
Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)
https://github.com/shlomif/perl-math-grahamfunction
git clone git://github.com/shlomif/perl-math-grahamfunction.git