Math::NumSeq::PowerFlip -- prime exponent flip
use Math::NumSeq::PowerFlip; my $seq = Math::NumSeq::PowerFlip->new; my ($i, $value) = $seq->next;
This sequence is i with primes and exponents flipped in the prime factorization.
i = p^e * q^f * ... becomes value = e^p * f^q * ...
1, 1, 1, 4, 1, 1, 1, 9, 8, 1, 1, 4, 1, 1, 1, 16, 1, 8, 1, 4, ... starting i=1
For example i=1000=2^3*5^3 becomes value=3^2*3^5=3^7=2187.
Any i=prime has value=1 since i=p^1 becomes value=1^p=1. Value=1 occurs precisely when i=p*q*r*etc with no repeated prime factor, ie. when i is square-free.
The possible values which occur 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 sequence values are a product of squares and higher.
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.
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$value = $seq->ith($i)
$iwith the prime powers and exponents flipped.
$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.
Copyright 2012, 2013 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/>.