1Math::NumSeq::JugglerStUespesr(3C)ontributed Perl DocumeMnattaht:i:oNnumSeq::JugglerSteps(3)
2
3
4

NAME

6       Math::NumSeq::JugglerSteps -- steps in the juggler sqrt sequence
7

SYNOPSIS

9        use Math::NumSeq::JugglerSteps;
10        my $seq = Math::NumSeq::JugglerSteps->new;
11        my ($i, $value) = $seq->next;
12

DESCRIPTION

14       This is the number of steps it takes to reach 1 by the Juggler sqrt
15       sequence,
16
17           n ->  /  floor(n^(1/2))      if n even
18                 \  floor(n^(3/2))      if n odd
19
20       So sqrt if n even, or sqrt(n^3) if n odd, each rounded downwards.  For
21       example i=17 goes 17 -> sqrt(17^3)=70 -> sqrt(70)=8 -> sqrt(8)=2 ->
22       sqrt(2)=1, for a count of 4 steps.
23
24           0, 1, 6, 2, 5, 2, 4, 2, 7, 7, 4, 7, 4, 7, 6, 3, 4, 3, 9, 3, ...
25           starting i=1
26
27       The intermediate values in the calculation can become quite large and
28       "Math::BigInt" is used if necessary.  There's some secret experimental
29       caching in a temporary file, for a small speedup.
30

FUNCTIONS

32       See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
33       classes.
34
35       "$seq = Math::NumSeq::JugglerSteps->new ()"
36       "$seq = Math::NumSeq::JugglerSteps->new (step_type => 'both',
37       juggler_type => '1/2-3/2')"
38           Create and return a new sequence object.
39
40           The optional "step_type" parameter (a string) selects between
41
42               "up"      upward steps sqrt(n^3)
43               "down"    downward steps sqrt(n)
44               "both"    both up and down, which is the default
45
46           The optional "juggler_type" parameter (a string) selects among
47           variations on the powering
48
49                             n even        n odd
50               "1/2-3/2"    sqrt(n)   and sqrt(n^3)
51               "2/3-3/2"    cbrt(n^2) and sqrt(n^3)
52               "3/4-4/3"    n^(3/4)   and n^(4/3)
53
54   Random Access
55       "$value = $seq->ith($i)"
56           Return the number of steps to take $i down to 1.
57
58       "$bool = $seq->pred($value)"
59           Return true if $value occurs as a step count.  This is simply
60           "$value >= 0".
61

SEE ALSO

63       Math::NumSeq, Math::NumSeq::CollatzSteps, Math::NumSeq::ReverseAddSteps
64

HOME PAGE

66       <http://user42.tuxfamily.org/math-numseq/index.html>
67

LICENSE

69       Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2019 Kevin Ryde
70
71       Math-NumSeq is free software; you can redistribute it and/or modify it
72       under the terms of the GNU General Public License as published by the
73       Free Software Foundation; either version 3, or (at your option) any
74       later version.
75
76       Math-NumSeq is distributed in the hope that it will be useful, but
77       WITHOUT ANY WARRANTY; without even the implied warranty of
78       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
79       General Public License for more details.
80
81       You should have received a copy of the GNU General Public License along
82       with Math-NumSeq.  If not, see <http://www.gnu.org/licenses/>.
83
84
85
86perl v5.34.0                      2021-07-22     Math::NumSeq::JugglerSteps(3)
Impressum