Sha256: 7e00e2b285839a3439b2d84a6b636551019d59a7b192805d08261fdbaf8214b3
Contents?: true
Size: 362 Bytes
Versions: 73
Compression:
Stored size: 362 Bytes
Contents
package Prime; use strict; use warnings; sub factors { my ($num) = @_; return [] if $num == 1; my @factors; my $i = 2; while ($i*$i <= $num) { my $div = $num/$i; if ($div == int $div) { push @factors, $i; $num = $div; next; } $i++; } push @factors, $num; return \@factors; } 1;
Version data entries
73 entries across 73 versions & 1 rubygems