1Math::NumSeq::NumAronsoUns(e3r)Contributed Perl DocumentMaattiho:n:NumSeq::NumAronson(3)
2
3
4
6 Math::NumSeq::NumAronson -- numerical version of Aronson's sequence
7
9 use Math::NumSeq::NumAronson;
10 my $seq = Math::NumSeq::NumAronson->new;
11 my ($i, $value) = $seq->next;
12
14 This is a self-referential sequence by Cloitre, Sloane and Vandermast,
15
16 "Numerical Analogues of Aronson's Sequence",
17 <http://arxiv.org/abs/math.NT/0305308>
18
19 The sequence begins
20
21 1, 4, 6, 7, 8, 9, 11, 13, ...
22 starting i=1
23
24 Starting with a(1)=1 the rule is "n is in the sequence iff a(n) is
25 odd". The result is a uniform pattern 3 steps by 1 then 3 steps by 2,
26 followed by 6 steps by 1 and 6 steps by 2, then 12, 24, 48, etc.
27
28 1,
29 4,
30 6, 7, 8, # 3 steps by 1
31 9, 11, 13, # 3 steps by 2
32 15, 16, 17, 18, 19, 20, # 6 steps by 1
33 21, 23, 25, 27, 29, 31, # 6 steps by 2
34 # 3*2^k steps by 1
35 # 3*2^k steps by 2
36
37 In general
38
39 numaronson(9*2^k-3+j) = 12*2^k - 3 + (3*j+abs(j))/2
40 where -3*2^k <= j < 3*2^k
41
42 The (3*j+abs(j))/2 part is the step, going by 1 if j<=0 and by 2 if
43 j>0.
44
46 See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
47 classes.
48
49 "$seq = Math::NumSeq::NumAronson->new ()"
50 Create and return a new sequence object.
51
52 Random Access
53 "$value = $seq->ith($i)"
54 Return the $ith value in the sequence.
55
56 "$bool = $seq->pred($value)"
57 Return true if $value occurs in the sequence.
58
60 Math::NumSeq, Math::NumSeq::Aronson
61
63 <http://user42.tuxfamily.org/math-numseq/index.html>
64
66 Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2019 Kevin Ryde
67
68 Math-NumSeq is free software; you can redistribute it and/or modify it
69 under the terms of the GNU General Public License as published by the
70 Free Software Foundation; either version 3, or (at your option) any
71 later version.
72
73 Math-NumSeq is distributed in the hope that it will be useful, but
74 WITHOUT ANY WARRANTY; without even the implied warranty of
75 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
76 General Public License for more details.
77
78 You should have received a copy of the GNU General Public License along
79 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
80
81
82
83perl v5.32.0 2020-07-28 Math::NumSeq::NumAronson(3)