NAME

Math::Factor - factorise integers and calculate matching multiplications.

SYNOPSIS

use Math::Factor q/:all/;

@numbers = (9);

# data manipulation
%factors = factor (\@numbers);
%matches = match (\%factors);

# output
show_factor (\%factors);
show_match (\%matches);

DESCRIPTION

see above.

FUNCTIONS

factor

Factorises numbers.

%factors = factor (\@numbers);

Each number within @numbers will be entirely factorised and its factors will be saved within %factors, accessible by the number itself e.g the factors of 9 may be accessed by @{$factors{9}}.

match

Evaluates matching multiplications.

%matches = match (\%factors);

The factors of each number within %factors will be multplicated against each other and results the equal the number itself, will be saved to %matches. The matches are accessible through the according numbers e.g. the first two numbers that matched 9, may be accessed by $matches{9}[0][0] and $matches{9}[0][1], the second ones by $matches{9}[1][0] and $matches{9}[1][1], and so on.

show_factor

Outputs all numbers and their according factors to STDOUT.

show_factor (\%factors);

  9
  -
  1    3    9

show_match

Outputs all numbers and their according matching multiplications to STDOUT.

show_match (\%matches);

  9
  -
  1 * 9
  3 * 3

LIMITATIONS

Evaluating ranges of factors or multiplication matches is unimplemented aswell as iterating factors or multiplication matches.

EXPORT

factor(), match(), show_factor(), show_match() upon request.

TAGS

:all - *()

:factor - factor(), show_factor()

:match - match(), show_match()

SEE ALSO

perl(1)

LICENSE

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Steven Schubiger