Math::N...owerFlip(3)
π Math::N...owerFlip(3) β ok bestie, it's a User Contributed Perl Documentation page, and it's giving MATH β¨
πΈ NAME πΈ
Math::NumSeq::PowerFlip β prime exponent flip π«Ά
β¨ SYNOPSIS β¨
use Math::NumSeq::PowerFlip;
my $seq = Math::NumSeq::PowerFlip->new;
my ($i, $value) = $seq->next;
π¦ DESCRIPTION π¦
okay so this sequence takes a number i and, like, flips the primes and the exponents in its prime factorization?? iconic behavior honestly.
i = p^e * q^f * ...
becomes
value = e^p * f^q * ...
which gives us
1, 1, 1, 4, 1, 1, 1, 9, 8, 1, 1, 4, 1, 1, 1, 16, 1, 8, 1, 4, ...
starting i=1
like for example, i=1000=2^3*5^3 becomes value=3^2*3^5=3^7=2187. the way that works?? no cap π
any i=prime has value=1 since i=p^1 becomes value=1^p=1. and value=1 occurs precisely when i=p*q*r*etc with no repeated prime factor, ie. when i is square-free. periodt π
so the possible values that show up in the sequence are related to square factors. since value=e^p has prime p>=2, every e,f,g etc powered up in the value is a square or higher power. so basically sequence values are a product of squares and higher. lowkey obsessed with this.
β οΈ these calculations require 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 yeah, it just stops there, bestie, and that's on purpose π
π₯ FUNCTIONS π₯
see "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes. shared lore, iykyk.
"$seq = Math::NumSeq::PowerFlip->new ()"β create and return a new sequence object. brand new, main character energy π
π Random Access π
"$value = $seq->ith($i)"β return$iwith the prime powers and exponents flipped. the glow-up π"$bool = $seq->pred($value)"β return true if$valueoccurs in the sequence. as noted above, this means an integer$valuewith at least one squared prime factor. slay β
π SEE ALSO π
- Math::NumSeq
- Math::NumSeq::PrimeFactorCount
π HOME PAGE π
<http://user42.tuxfamily.org/math-numseq/index.html>
π LICENSE π
Copyright 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/>.
and that's the whole page bestie, written for perl v5.42.0, dated 2025-07-25 β go forth and flip some exponents, ily πβ¨
π¦ 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