Math::N...owerPart(3)
π Math::NumSeq::PowerPart π
okay bestie, welcome to the Math::NumSeq::PowerPart page β it's a User Contributed Perl Documentation joint, and it's literally about the largest square root etc divisor. yes that's the actual NAME. we're starting strong.
β¨ SYNOPSIS β¨
use Math::NumSeq::PowerPart;
my $seq = Math::NumSeq::PowerPart->new (power => 2);
my ($i, $value) = $seq->next;
that's it. three lines. slay. π
πΈ DESCRIPTION πΈ
so this sequence is the largest integer whose square is a divisor of i. the whole vibe:
1, 1, 1, 2, 1, 1, 1, 2, 3, ...
starting i=1
like, at i=27 the value is 3, because 3^2=9 is the biggest square that divides 27. and notice β the value is the square root, aka 3, of the divisor. NOT the square 9. we do not return the square. we return the root. periodt.
when i has no square divisor at all β meaning it's square-free β the value is 1. π«Ά
compare it to "MobiusFunction" where a value of 1 or -1 means square-free. and flip it: "MobiusFunction" is 0 when there IS a square factor, and here PowerPart's value is > 1 in exactly that case. iykyk.
π₯ Power Option π₯
the "power" parameter picks which power divisor we're hunting for. so "power=>3" finds the largest cube dividing i, and the sequence values are the cube roots:
power=>3
1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, ...
for example at i=24 the value is 2, since 2^3=8 is the largest cube dividing 24. iconic. π
π FUNCTIONS π
go look at "FUNCTIONS" in Math::NumSeq for the behaviour that's common to all sequence classes, bestie. that's the shared lore.
"$seq = Math::NumSeq::PowerPart->new ()""$seq = Math::NumSeq::PowerPart->new (power => $integer)"β create and return a new sequence object. that's the whole job.
π§ Random Access π§
"$value = $seq->ith($i)"β return the largest perfect square, cube, etc root dividing$i.
β οΈ heads up bestie: this calculation requires factorizing$i, and in the current code, after small factors, a hard limit of2**32is enforced β in the interests of not going into a near-infinite loop. so like. respect the limit. π
"$bool = $seq->pred($value)"β return true if$valueoccurs in the sequence, which is simply any integer"$value >= 1". that's it, that's the test, no cap.
π¦ SEE ALSO π¦
Math::NumSeqMath::NumSeq::MobiusFunctionMath::NumSeq::Powerful
the whole friend group. β¨
π HOME PAGE π
<http://user42.tuxfamily.org/math-numseq/index.html>
go say hi, it's giving main character energy. π
π LICENSE π
Copyright 2011, 2012, 2013, 2014, 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 <http://www.gnu.org/licenses/>.
π₯Ί no warranty bestie, we said what we said. read the license, it's right there.
and that's the whole page, babe β perl v5.42.0, dated 2025-07-25, straight from the Math::N...owerPart(3) corner of the User Contributed Perl Documentation. mwah. πππ¦
π¦ where this page comes from
- fedora 43: perl-Math-NumSeq 75-11.fc43 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms