1Math::NumSeq::ReReplaceU(s3e)r Contributed Perl DocumentaMtaitohn::NumSeq::ReReplace(3)
2
3
4

NAME

6       Math::NumSeq::ReReplace -- sequence of repeated replacements
7

SYNOPSIS

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

DESCRIPTION

14       This is a sequence by David Madore formed by repeatedly replacing every
15       N'th occurrence of a term with N.
16
17           1, 2, 1, 2, 3, 3, 1, 2, 4, 4, 3, 4, ...
18
19       As per
20
21           David Madore, "have you seen this sequence?", sci.math.research, 24
22           Oct 2004,
23           <http://sci.tech-archive.net/Archive/sci.math.research/2004-10/0218.html>
24
25           <http://www.madore.org/~david/.misc/seq.png>
26
27   Stages
28       The generating procedure begins with all 1s,
29
30           stage 0: 1,1,1,1,1,1,1,1,1,1,1,1,...
31
32       Then every second 1 is changed to 2
33
34           stage 1: 1,2,1,2,1,2,1,2,1,2,1,2,...
35
36       Then every third 1 is changed to 3, and every third 2 changed to 3
37       also,
38
39           stage 2: 1,2,1,2,3,3,1,2,1,2,3,3,...
40
41       Then every fourth 1 becomes 4, every fourth 2 becomes 4, and every
42       fourth 3 becomes 4.
43
44           stage 3: 1,2,1,2,3,3,1,2,4,4,3,4,...
45
46       The replacement by N of every Nth is applied separately to the 1s, 2s,
47       3s etc remaining at each stage.
48
49       The optional "stage => $n" parameter limits the replacements to a given
50       number of stages of the algorithm.  The default -1 means unlimited.
51

FUNCTIONS

53       See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
54       classes.
55
56       "$seq = Math::NumSeq::ReReplace->new ()"
57       "$seq = Math::NumSeq::ReRound->new (stages => $integer)"
58           Create and return a new sequence object.
59
60       "$bool = $seq->pred($value)"
61           Return true if $value occurs in the sequence.  This merely means
62           integer "$value >= 1".
63

SEE ALSO

65       Math::NumSeq, Math::NumSeq::ReRound
66

HOME PAGE

68       <http://user42.tuxfamily.org/math-numseq/index.html>
69

LICENSE

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.0                      2020-07-28        Math::NumSeq::ReReplace(3)
Impressum