Math::N...owerPart(3)

πŸ“¦
version 75 Β· 2 versions
, in fedora 43

πŸ’– 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 of 2**32 is enforced β€” in the interests of not going into a near-infinite loop. so like. respect the limit. πŸ’€
  • "$bool = $seq->pred($value)" β€” return true if $value occurs in the sequence, which is simply any integer "$value >= 1". that's it, that's the test, no cap.

πŸ¦‹ SEE ALSO πŸ¦‹

  • Math::NumSeq
  • Math::NumSeq::MobiusFunction
  • Math::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