Math::NumSeq::Powerful -- numbers with certain prime powers


 use Math::NumSeq::Powerful;
 my $seq = Math::NumSeq::Powerful->new (powerful_type => 'some',
                                        power => 2);
 my ($i, $value) = $seq->next;


This is integers with a minimum prime power. The powerful_type option (a string) can be

    "some"       some exp >= power
    "all"        all exp >= power

The default is "some" and power=2, which means there must be some prime factor which is a square or higher,

    # default powerful_type="some" power=2

    4, 8, 9, 12, 16, 18, 20, ...
    starting i=1

These are the non-squarefrees. The squarefrees have no square factor, and these non-squarefrees have at least one square factor. (Sometimes this is called "squareful" but this can be confused with the "all" style where all primes must be a square or better.)

The "all" option with power=2 demands that all primes are square or higher.

    powerful_type="all" power=2
    1, 4, 8, 9, 16, 25, 27, 32, 36, ...

Notice for example 12=2*2*3 is excluded because its prime factor 3 is not squared or better. 1 is included on the basis that it has no prime factors.


See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.

$seq = Math::NumSeq::Powerful->new (powerful_type => $str, power => $integer)

Create and return a new sequence object. powerful_type can be

    "some"    (the default)

power must be 2 or more.

Random Access

$bool = $seq->pred($value)

Return true if $value has prime powers of the given type.


Math::NumSeq, Math::NumSeq::Squares, Math::NumSeq::Cubes, Math::NumSeq::PowerPart



Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2019, 2020 Kevin Ryde

Math-NumSeq is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Math-NumSeq is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Math-NumSeq. If not, see <>.