1Math::NumSeq::MaxDigitCUosuenrt(C3o)ntributed Perl DocumMeanttha:t:iNounmSeq::MaxDigitCount(3)
2
3
4
6 Math::NumSeq::MaxDigitCount -- maximum count of a given digit in any
7 radix
8
10 use Math::NumSeq::MaxDigitCount;
11 my $seq = Math::NumSeq::MaxDigitCount->new (values_type => 'count');
12 my ($i, $value) = $seq->next;
13
15 This is the maximum count of a given digit which occurs when i is
16 written in any radix. The default digit is 0.
17
18 0, 1, 1, 2, 1, 1, 1, 3, 2, 2, 1, 2, 1, 1, 1, 4, 3, 3, 2, ...
19 starting i=1
20
21 For example i=15 is 1 because 15 = ternary "120" which has 1 zero, and
22 no other base has more than that. i is "10" in base i itself so
23 there's always at least 1 zero, after i=1.
24
25 Radix
26 Option "values_type => 'radix'" gives the radix where the maximum
27 occurs,
28
29 # values_type => "radix"
30 2, 2, 3, 2, 2, 2, 7, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, ...
31
32 If the maximum count occurs in more than one radix the value is the
33 smallest where it occurs. i=1 has no zeros in any radix and the return
34 is 2 for binary since the count 0 occurs in that radix.
35
36 Digit
37 Option "digit => $n" selects another digit to count, for example
38
39 # digit => 1
40 1, 1, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 3, 3, 4, 2, 2, 2, 3, ...
41
42 For example at i=7 the count is 3 since 7 in binary is "111" with 3
43 digit 1s.
44
46 See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
47 classes.
48
49 "$seq = Math::NumSeq::MaxDigitCount->new ()"
50 "$seq = Math::NumSeq::MaxDigitCount->new (digit => $d, values_type =>
51 $str)"
52 Create and return a new sequence object.
53
54 Random Access
55 "$value = $seq->ith($i)"
56 Return the count or radix for the selected digit when $i is written
57 in any radix.
58
59 "$bool = $seq->pred($value)"
60 Return true if $value occurs in the sequence. This simply means
61 $value an integer, but excluding 0 when seeking digit=1, or
62 excluding 1 when seeking the radix.
63
65 Math::NumSeq, Math::NumSeq::DigitCount
66
68 <http://user42.tuxfamily.org/math-numseq/index.html>
69
71 Copyright 2012, 2013, 2014, 2016, 2019 Kevin Ryde
72
73 Math-NumSeq is free software; you can redistribute it and/or modify it
74 under the terms of the GNU General Public License as published by the
75 Free Software Foundation; either version 3, or (at your option) any
76 later version.
77
78 Math-NumSeq is distributed in the hope that it will be useful, but
79 WITHOUT ANY WARRANTY; without even the implied warranty of
80 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
81 General Public License for more details.
82
83 You should have received a copy of the GNU General Public License along
84 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
85
86
87
88perl v5.32.1 2021-01-27 Math::NumSeq::MaxDigitCount(3)