Math::N...owerFlip(3)

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

πŸ’… 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 $i with the prime powers and exponents flipped. the glow-up πŸ’…
  • "$bool = $seq->pred($value)" β€” return true if $value occurs in the sequence. as noted above, this means an integer $value with 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