1Math::NumSeq::DigitLengUtsheCrumCuolnattriivbeu(t3e)d PeMralthD:o:cNuummeSnetqa:t:iDoingitLengthCumulative(3)
2
3
4
6 Math::NumSeq::DigitLengthCumulative -- total length in digits of
7 numbers 1 to i
8
10 use Math::NumSeq::DigitLengthCumulative;
11 my $seq = Math::NumSeq::DigitLengthCumulative->new (radix => 10);
12 my ($i, $value) = $seq->next;
13
15 The total length of numbers 0 to i, starting from i=0.
16
17 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 20, 22, 24, 26, ...
18
19 "0" is taken to be a single digit, so the initial i=0 is total length
20 1. Then it's length 1 more for each of i=1 to i=9, then at i=10 length
21 2 more, etc.
22
23 The default is decimal, or the optional "radix" parameter can select
24 another base. For example "radix => 3" ternary,
25
26 1, 2, 3, 5, 7, 9, 11, 13, 15, 18, 21, 24, 27, 30, ...
27
29 See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
30 classes.
31
32 "$seq = Math::NumSeq::DigitLengthCumulative->new (radix => $r)"
33 Create and return a new sequence object.
34
35 Random Access
36 "$value = $seq->ith($i)"
37 Return total length in digits of the numbers 0 to $i, inclusive.
38
39 "$bool = $seq->pred($value)"
40 Return true if $value occurs in the sequence.
41
42 "$i = $seq->value_to_i_floor($value)"
43 Return the index i of $value or of the next cumulative total below
44 $value.
45
46 "$i = $seq->value_to_i_estimate($value)"
47 Return an estimate of the i corresponding to $value.
48
50 Math::NumSeq, Math::NumSeq::DigitLength
51
53 <http://user42.tuxfamily.org/math-numseq/index.html>
54
56 Copyright 2010, 2011, 2012, 2013, 2014 Kevin Ryde
57
58 Math-NumSeq is free software; you can redistribute it and/or modify it
59 under the terms of the GNU General Public License as published by the
60 Free Software Foundation; either version 3, or (at your option) any
61 later version.
62
63 Math-NumSeq is distributed in the hope that it will be useful, but
64 WITHOUT ANY WARRANTY; without even the implied warranty of
65 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
66 General Public License for more details.
67
68 You should have received a copy of the GNU General Public License along
69 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
70
71
72
73perl v5.28.1 2014-06M-a2t9h::NumSeq::DigitLengthCumulative(3)