1Math::PlanePath::CellulUasreRrulCeo5n4t(r3i)buted Perl DMoactuhm:e:nPtlaatnieoPnath::CellularRule54(3)
2
3
4

NAME

6       Math::PlanePath::CellularRule54 -- cellular automaton points
7

SYNOPSIS

9        use Math::PlanePath::CellularRule54;
10        my $path = Math::PlanePath::CellularRule54->new;
11        my ($x, $y) = $path->n_to_xy (123);
12

DESCRIPTION

14       This is the pattern of Stephen Wolfram's "rule 54" cellular automaton
15
16           <http://mathworld.wolfram.com/Rule54.html>
17
18       arranged as rows,
19
20           29 30 31  . 32 33 34  . 35 36 37  . 38 39 40     7
21              25  .  .  . 26  .  .  . 27  .  .  . 28        6
22                 16 17 18  . 19 20 21  . 22 23 24           5
23                    13  .  .  . 14  .  .  . 15              4
24                        7  8  9  . 10 11 12                 3
25                           5  .  .  .  6                    2
26                              2  3  4                       1
27                                 1                      <- Y=0
28
29           -7 -6 -5 -4 -3 -2 -1 X=0 1  2  3  4  5  6  7
30
31       The initial figure N=1,2,3,4 repeats in two-row groups with 1 cell gap
32       between figures.  Each two-row group has one extra figure, for a step
33       of 4 more points than the previous two-row.
34
35       The rightmost N on the even rows Y=0,2,4,6 etc is the hexagonal numbers
36       N=1,6,15,28, etc k*(2k-1).  The hexagonal numbers of the "second kind"
37       1, 3, 10, 21, 36, etc j*(2j+1) are a steep sloping line upwards in the
38       middle too.  Those two taken together are the triangular numbers
39       1,3,6,10,15 etc, k*(k+1)/2.
40
41       The 18-gonal numbers 18,51,100,etc are the vertical line at X=-3 on
42       every fourth row Y=5,9,13,etc.
43
44   Row Ranges
45       The left end of each row is
46
47           Nleft = Y*(Y+2)/2 + 1     if Y even
48                   Y*(Y+1)/2 + 1     if Y odd
49
50       The right end is
51
52           Nright = (Y+1)*(Y+2)/2    if Y even
53                    (Y+1)*(Y+3)/2    if Y odd
54
55                  = Nleft(Y+1) - 1   ie. 1 before next Nleft
56
57       The row width Xmax-Xmin is 2*Y but with the gaps the number of visited
58       points in a row is less than that, being either about 1/4 or 3/4 of the
59       width on even or odd rows.
60
61           rowpoints = Y/2 + 1        if Y even
62                       3*(Y+1)/2      if Y odd
63
64       For any Y of course the Nleft to Nright difference is the number of
65       points in the row too
66
67           rowpoints = Nright - Nleft + 1
68
69   N Start
70       The default is to number points starting N=1 as shown above.  An
71       optional "n_start" can give a different start, in the same pattern.
72       For example to start at 0,
73
74           n_start => 0
75
76           15 16 17    18 19 20    21 22 23           5
77              12          13          14              4
78                  6  7  8     9 10 11                 3
79                     4           5                    2
80                        1  2  3                       1
81                           0                      <- Y=0
82
83           -5 -4 -3 -2 -1 X=0 1  2  3  4  5
84

FUNCTIONS

86       See "FUNCTIONS" in Math::PlanePath for behaviour common to all path
87       classes.
88
89       "$path = Math::PlanePath::CellularRule54->new ()"
90       "$path = Math::PlanePath::CellularRule54->new (n_start => $n)"
91           Create and return a new path object.
92
93       "($x,$y) = $path->n_to_xy ($n)"
94           Return the X,Y coordinates of point number $n on the path.
95
96       "$n = $path->xy_to_n ($x,$y)"
97           Return the point number for coordinates "$x,$y".  $x and $y are
98           each rounded to the nearest integer, which has the effect of
99           treating each cell as a square of side 1.  If "$x,$y" is outside
100           the pyramid or on a skipped cell the return is "undef".
101

OEIS

103       This pattern is in Sloane's Online Encyclopedia of Integer Sequences in
104       a couple of forms,
105
106           <http://oeis.org/A118108> (etc)
107
108           A118108    whole-row used cells as bits of a bignum
109           A118109    1/0 used and unused cells across rows
110

SEE ALSO

112       Math::PlanePath, Math::PlanePath::CellularRule,
113       Math::PlanePath::CellularRule57, Math::PlanePath::CellularRule190,
114       Math::PlanePath::PyramidRows
115
116       Cellular::Automata::Wolfram
117
118       <http://mathworld.wolfram.com/Rule54.html>
119

HOME PAGE

121       <http://user42.tuxfamily.org/math-planepath/index.html>
122

LICENSE

124       Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 Kevin Ryde
125
126       This file is part of Math-PlanePath.
127
128       Math-PlanePath is free software; you can redistribute it and/or modify
129       it under the terms of the GNU General Public License as published by
130       the Free Software Foundation; either version 3, or (at your option) any
131       later version.
132
133       Math-PlanePath is distributed in the hope that it will be useful, but
134       WITHOUT ANY WARRANTY; without even the implied warranty of
135       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
136       General Public License for more details.
137
138       You should have received a copy of the GNU General Public License along
139       with Math-PlanePath.  If not, see <http://www.gnu.org/licenses/>.
140
141
142
143perl v5.28.0                      2017-12-03Math::PlanePath::CellularRule54(3)
Impressum