1Math::NumSeq::PowerPartU(s3e)r Contributed Perl DocumentaMtaitohn::NumSeq::PowerPart(3)
2
3
4
6 Math::NumSeq::PowerPart -- largest square root etc divisor
7
9 use Math::NumSeq::PowerPart;
10 my $seq = Math::NumSeq::PowerPart->new (power => 2);
11 my ($i, $value) = $seq->next;
12
14 This sequence is the largest integer whose square is a divisor of i,
15
16 1, 1, 1, 2, 1, 1, 1, 2, 3, ...
17 starting i=1
18
19 For example at i=27 the value is 3 since 3^2=9 is the largest square
20 which is a divisor of 27. Notice the sequence value is the square
21 root, ie. 3, of the divisor, not the square 9.
22
23 When i has no square divisor, ie. is square-free, the value is 1.
24 Compare the "MobiusFunction" where value 1 or -1 means square-free.
25 And conversely "MobiusFunction" is 0 when there's a square factor, and
26 PowerPart value here is > 1 in that case.
27
28 Power Option
29 The "power" parameter selects what power divisor to seek. For example
30 "power=>3" finds the largest cube dividing i and the sequence values
31 are the cube roots.
32
33 power=>3
34 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, ...
35
36 For example i=24 the value is 2, since 2^3=8 is the largest cube which
37 divides 24.
38
40 See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
41 classes.
42
43 "$seq = Math::NumSeq::PowerPart->new ()"
44 "$seq = Math::NumSeq::PowerPart->new (power => $integer)"
45 Create and return a new sequence object.
46
47 Random Access
48 "$value = $seq->ith($i)"
49 Return the largest perfect square, cube, etc root dividing $i.
50
51 This calculation requires factorizing $i and in the current code
52 after small factors a hard limit of 2**32 is enforced in the
53 interests of not going into a near-infinite loop.
54
55 "$bool = $seq->pred($value)"
56 Return true if $value occurs in the sequence, which is simply any
57 integer "$value >= 1".
58
60 Math::NumSeq, Math::NumSeq::MobiusFunction, Math::NumSeq::Powerful
61
63 <http://user42.tuxfamily.org/math-numseq/index.html>
64
66 Copyright 2011, 2012, 2013, 2014 Kevin Ryde
67
68 Math-NumSeq is free software; you can redistribute it and/or modify it
69 under the terms of the GNU General Public License as published by the
70 Free Software Foundation; either version 3, or (at your option) any
71 later version.
72
73 Math-NumSeq is distributed in the hope that it will be useful, but
74 WITHOUT ANY WARRANTY; without even the implied warranty of
75 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
76 General Public License for more details.
77
78 You should have received a copy of the GNU General Public License along
79 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
80
81
82
83perl v5.28.0 2014-06-29 Math::NumSeq::PowerPart(3)