Math-NumSeq
view release on metacpan or search on metacpan
lib/Math/NumSeq/JugglerSteps.pm view on Meta::CPAN
$VERSION = 75;
use Math::NumSeq;
use Math::NumSeq::Base::IterateIth;
@ISA = ('Math::NumSeq::Base::IterateIth',
'Math::NumSeq');
use Math::NumSeq::Base::Cache
'cache_hash',
'make_key';
# uncomment this to run the ### lines
#use Devel::Comments;
# use constant name => Math::NumSeq::__('Juggler Steps');
use constant description => Math::NumSeq::__('Number of steps to reach 1 in the Juggler sqrt sequence.');
use constant characteristic_count => 1;
use constant characteristic_smaller => 1;
use constant characteristic_increasing => 0;
use constant values_min => 0;
use constant i_start => 1;
use constant parameter_info_array =>
[
{ name => 'step_type',
display => Math::NumSeq::__('Step Type'),
type => 'enum',
default => 'both',
choices => ['up','down','both'],
choices_display => [Math::NumSeq::__('Up'),
Math::NumSeq::__('Down'),
Math::NumSeq::__('Both'),
],
description => Math::NumSeq::__('Which steps to count, the n^(3/2) ups, the n^(1/2) downs, or both.'),
},
{ name => 'juggler_type',
display => Math::NumSeq::__('Juggler Algorithm Type'),
type => 'string',
default => '1/2-3/2',
width => 9,
choices => ['1/2-3/2','2/3-3/2','3/4-4/3'],
description => Math::NumSeq::__('Juggler algorithm type, as the even power and odd power.'),
},
# { name => 'round_type',
# display => Math::NumSeq::__('Rounding Type'),
# type => 'enum',
# default => 'floor',
# choices => ['floor','round'],
# choices_display => [Math::NumSeq::__('Floor'),
# Math::NumSeq::__('Round'),
# ],
# description => Math::NumSeq::__('Rounding type.'),
# },
];
#------------------------------------------------------------------------------
# eg. 78901 peaks at about 370,000 digits ...
#
# cf
# A094683 - iteration, ie. n^(1/2) or n^(3/2)
# A094670 - smallest requiring n iterations
# A094679 - start requiring n iterations
# A094684 - records in plain seq
# A094698 - num steps where new record
# A143745 - next largest
# A094716 - largest value in trajectory starting from n
# A094778 - dropping time from odd
# A094804 - num primes in trajectory
# A094819 - steps starting 10^n
# A143742 - producing larger value
# A143743 - num digits
# A143744 - steps next largest
#
# A007321 - rounded steps
# A094685 - rounded iteration, ie. single powering
# A094693 - rounded records
# A094725 - rounded largest value in trajectory starting from n
# A095910 - rounded records
# A095911 - rounded num steps to records
#
# A095396 - 2/3-3/2 iteration
# A095397 - 2/3-3/2 largest in trajectory starting from n
# A095398 - 2/3-3/2 steps
#
# A095399 - 3/4-4/3 iteration
# A095400 - 3/4-4/3 largest value in trajectory starting from n
# A095401 - 3/4-4/3 steps
#
# up => '',
# # OEIS-Catalogue: step_type=up
#
# down => '',
# # OEIS-Catalogue: step_type=down
#
my %oeis_anum = (
# both up and down
both => { '1/2-3/2' => 'A007320',
# OEIS-Catalogue: A007320
'2/3-3/2' => 'A095398',
# OEIS-Catalogue: A095398 juggler_type=2/3-3/2
'3/4-4/3' => 'A095401',
# OEIS-Catalogue: A095401 juggler_type=3/4-4/3
},
);
sub oeis_anum {
my ($self) = @_;
return $oeis_anum{$self->{'step_type'}}->{$self->{'juggler_type'}};
}
#------------------------------------------------------------------------------
sub rewind {
my ($self) = @_;
($self->{'epow'},$self->{'eroot'}, $self->{'opow'},$self->{'oroot'})
= ($self->{'juggler_type'} =~ m{(\d+)/(\d+)-(\d+)/(\d+)});
$self->{'i'} = i_start();
}
use constant 1.02; # for leading underscore
use constant _UV_3_2_LIMIT => do {
( run in 1.566 second using v1.01-cache-2.11-cpan-71847e10f99 )