1Math::NumSeq::AsciiSelfU(s3e)r Contributed Perl DocumentaMtaitohn::NumSeq::AsciiSelf(3)
2
3
4

NAME

6       Math::NumSeq::AsciiSelf -- sequence is its own ASCII digits
7

SYNOPSIS

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

DESCRIPTION

14       A sequence which is itself in ASCII, Sloane's OEIS A109733.
15
16           53, 51, 53, 49, 53, 51, 52, 57, etc
17
18       The first value 53 is digits 5,3 which in ASCII is the initial 53 and
19       append 51.  That new 51 is digits 5,1 which is ASCII 53 and 49 which
20       are appended.  Then those new digits 5,3,4,9 are ASCII 53,51,52,57
21       which are appended, and so on.
22
23       Notice that interpreting the sequence values as ASCII gives the digits
24       of the sequence itself, and conversely expanding each value to its
25       digits represented in ASCII leaves the sequence unchanged.
26
27       The default is digits in decimal.  There's an experimental mostly-
28       working "radix" parameter to do it in other bases.  Bases 8, 12 and 16
29       end up as repetitions of a single value, which is not very interesting.
30       Bases 5, 9 and 13 have a choice of two starting self-ASCII values, but
31       only the smallest is used for now.  Base 7 "ith()" is wrong, but
32       <next()> is right.
33

FUNCTIONS

35       See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
36       classes.
37
38       "$seq = Math::NumSeq::AsciiSelf->new ()"
39           Create and return a new sequence object.
40
41   Random Access
42       "$value = $seq->ith($i)"
43           Return the $i'th member of the sequence.  The first is i=1.
44

FORMULAS

46   Ith
47       The doubling described above is the key to the sequence structure.
48       Numbering from k=i-1 so k=0 is the first member, take the bits of k
49       from high to low.  Start with value 53.  At each bit expand the value
50       to its digits in ASCII so for example 53 -> 53,51.  Take the first or
51       second according to whether the bit from k is 0 or 1.
52
53   Next
54       The bits of k for the ith calculation can be retained and incremented
55       by a carry algorithm, rather than breaking down in each "next()" call.
56       The two expanded ASCII values can be kept at each bit and selected by
57       the bit value.
58
59   Radix
60       With the experimental "radix" parameter for base 6 and smaller the
61       ASCII expands to 3 or more values.  For example 48 in binary is 110000
62       so six ASCII 49,49,48,48,48,48.  The calculations are the same, but
63       digits of that size rather than bits.
64
65       In base 7 the digit lengths vary, since 48=66[7] and 49=100[7], so for
66       it the digit range depends on the expansion.  That's fine for "next()"
67       where the number of digits at each state is available, but how best
68       might "ith()" notice the shorter count for zeros?
69

BUGS

71       "ith()" gives wrong values for the experimental "radix" parameter for
72       radix 7.  "can('ith')" returns false for that radix, as a way of saying
73       "ith()" is not available.  (Other bases are ok.)
74

SEE ALSO

76       Math::NumSeq
77

HOME PAGE

79       <http://user42.tuxfamily.org/math-numseq/index.html>
80

LICENSE

82       Copyright 2011, 2012, 2013, 2014, 2016, 2019 Kevin Ryde
83
84       Math-NumSeq is free software; you can redistribute it and/or modify it
85       under the terms of the GNU General Public License as published by the
86       Free Software Foundation; either version 3, or (at your option) any
87       later version.
88
89       Math-NumSeq is distributed in the hope that it will be useful, but
90       WITHOUT ANY WARRANTY; without even the implied warranty of
91       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
92       General Public License for more details.
93
94       You should have received a copy of the GNU General Public License along
95       with Math-NumSeq.  If not, see <http://www.gnu.org/licenses/>.
96
97
98
99perl v5.32.0                      2020-07-28        Math::NumSeq::AsciiSelf(3)
Impressum