NumSeq/PlanePathN.pm untested

filter: Statementstmt 0.0% 0 / 2119 Branchbran 0.0% 0 / 66 Conditioncond 0.0% 0 / 117 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 624 Podpod 0.0% 0 / 75 totaltotal 0.0% 0 / 3001 SCAR 70.8
CC
34
Cov
0%
oeis_anum
30.0
_NumSeq_Diagonal_increasing
20.0
new
12.0
CRAP 1190.0
1 # Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Kevin Ryde
2  
3 # This file is part of Math-PlanePath.
4 #
5 # Math-PlanePath is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 3, or (at your option) any later
8 # version.
9 #
10 # Math-PlanePath is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.
17  
18  
19 # Maybe:
20 # "Turn" N of turn positions
21 # $path->n_next_turn($n)
22  
23  
24 package Math::NumSeq::PlanePathN;
25 use 5.004;
26 use strict;
27 use Carp 'croak';
28 use constant 1.02;
29  
30 use vars '$VERSION','@ISA';
31 $VERSION = 127;
32 use Math::NumSeq;
33 @ISA = ('Math::NumSeq');
34  
35 use Math::NumSeq::PlanePathCoord;
36  
37 # uncomment this to run the ### lines
38 # use Smart::Comments;
39  
40  
41 sub description {
42 my ($self) = @_;
43 if (ref $self) {
44 return "N values on $self->{'line_type'} of path $self->{'planepath'}";
45 } else {
46 # class method
47 return 'N values from a PlanePath';
48 }
49 }
50  
51 use constant::defer parameter_info_array =>
52 sub {
53 return [
54 Math::NumSeq::PlanePathCoord::_parameter_info_planepath(),
55  
56 { name => 'line_type',
57 display => 'Line Type',
58 type => 'enum',
59 default => 'X_axis',
60 choices => ['X_axis',
61 'Y_axis',
62 'X_neg',
63 'Y_neg',
64 'Diagonal',
65 'Diagonal_NW',
66 'Diagonal_SW',
67 'Diagonal_SE',
68 'Depth_start',
69 'Depth_end',
70 ],
71 description => 'The axis or line to take path N values from.',
72 },
73 ];
74 };
75  
76 #------------------------------------------------------------------------------
77  
78 my %oeis_anum =
79 (
80 # MultipleRings,step=0 -- integers 1,2,3, etc, but starting i=0
81 );
82  
83 sub oeis_anum {
84 my ($self) = @_;
85 ### PlanePathN oeis_anum() ...
86  
87 my $planepath_object = $self->{'planepath_object'};
88 {
89 my $key = Math::NumSeq::PlanePathCoord::_planepath_oeis_anum_key($self->{'planepath_object'});
90 my $i_start = $self->i_start;
91 if ($i_start != $self->default_i_start) {
92 ### $i_start
93 ### cf n_start: $planepath_object->n_start
94 $key .= ",i_start=$i_start";
95 }
96  
97 ### planepath: ref $planepath_object
98 ### $key
99 ### whole table: $planepath_object->_NumSeq_N_oeis_anum
100 ### key href: $planepath_object->_NumSeq_N_oeis_anum->{$key}
101  
102 if (my $anum = $planepath_object->_NumSeq_N_oeis_anum->{$key}->{$self->{'line_type'}}) {
103 return $anum;
104 }
105 if (my $anum = $planepath_object->_NumSeq_N_oeis_all_anum->{$self->{'line_type'}}) {
106 return $anum;
107 }
108 }
109 {
110 my $key = Math::NumSeq::PlanePathCoord::_planepath_oeis_key($planepath_object);
111 my $i_start = $self->i_start;
112 if ($i_start != $self->default_i_start) {
113 ### $i_start
114 ### cf n_start: $planepath_object->n_start
115 $key .= ",i_start=$i_start";
116 }
117 ### $key
118 ### hash: $oeis_anum{$key}
119 return $oeis_anum{$key}->{$self->{'line_type'}};
120 }
121 }
122  
123 #------------------------------------------------------------------------------
124  
125 sub default_i_start {
126 my ($self) = @_;
127  
128 my $planepath_object = $self->{'planepath_object'}
129 # nasty hack allow no 'planepath_object' when SUPER::new() calls rewind()
130 || return 0;
131  
132 my $method = "_NumSeq_$self->{'line_type'}_i_start";
133 if (my $func = $planepath_object->can($method)) {
134 return $planepath_object->$func();
135 }
136 return 0;
137 }
138 sub new {
139 my $self = shift->SUPER::new(@_);
140  
141 my $planepath_object = ($self->{'planepath_object'}
142 ||= Math::NumSeq::PlanePathCoord::_planepath_name_to_object($self->{'planepath'}));
143 ### $planepath_object
144  
145 my $line_type = $self->{'line_type'};
146  
147 ### i_func name: "i_func_$line_type"
148 $self->{'i_func'}
149 = $self->can("i_func_$line_type")
150 || croak "Unrecognised line_type: ",$line_type;
151  
152 $self->{'pred_func'}
153 = $self->can("pred_func_$line_type")
154 || croak "Unrecognised line_type: ",$line_type;
155  
156 if (my $func
157 = $planepath_object->can("_NumSeq_${line_type}_step")) {
158 $self->{'i_step'} = $planepath_object->$func();
159 } elsif ($planepath_object->_NumSeq_A2()
160 && ($line_type eq 'X_axis'
161 || $line_type eq 'Y_axis'
162 || $line_type eq 'X_neg'
163 || $line_type eq 'Y_neg')) {
164 $self->{'i_step'} = 2;
165 } else {
166 $self->{'i_step'} = 1;
167 }
168 ### i_step: $self->{'i_step'}
169  
170 # for use in pred()
171 $self->{'i_start'} = $self->i_start;
172  
173 $self->rewind;
174 return $self;
175 }
176  
177 sub rewind {
178 my ($self) = @_;
179 $self->{'i'} = $self->i_start;
180 }
181  
182 sub next {
183 my ($self) = @_;
184 ### NumSeq-PlanePathN next(): "i=$self->{'i'}"
185  
186 my $i = $self->{'i'};
187 my $n = &{$self->{'i_func'}} ($self, $i);
188 ### $n
189 if (! defined $n) {
190 ### i_func returns undef, no value ...
191 return;
192 }
193 # secret experimental automatic bigint to preserve precision
194 if (! ref $n && $n > 0xFF_FFFF) {
195 $n = &{$self->{'i_func'}}($self,_to_bigint($i));
196 }
197 return ($self->{'i'}++, $n);
198 }
199 sub _to_bigint {
200 my ($n) = @_;
201 # stringize to avoid UV->BigInt bug in Math::BigInt::GMP version 1.37
202 return _bigint()->new("$n");
203 }
204 # or maybe check for new enough for uv->mpz fix
205 use constant::defer _bigint => sub {
206 # no choice of back-end here, leave that to the mainline
207 require Math::BigInt;
208 return 'Math::BigInt';
209 };
210  
211 sub ith {
212 my ($self, $i) = @_;
213 ### NumSeq-PlanePathN ith(): $i
214 return &{$self->{'i_func'}}($self, $i);
215 }
216  
217 sub i_func_X_axis {
218 my ($self, $i) = @_;
219 my $path_object = $self->{'planepath_object'};
220 return $path_object->xy_to_n ($i * $self->{'i_step'},
221 $path_object->_NumSeq_X_axis_at_Y);
222 }
223 sub i_func_Y_axis {
224 my ($self, $i) = @_;
225 ### i_func_Y_axis(): "i=$i"
226 ### X: $self->{'planepath_object'}->_NumSeq_Y_axis_at_X
227 ### Y: $i * $self->{'i_step'}
228 my $path_object = $self->{'planepath_object'};
229 return $path_object->xy_to_n ($path_object->_NumSeq_Y_axis_at_X,
230 $i * $self->{'i_step'});
231 }
232 sub i_func_X_neg {
233 my ($self, $i) = @_;
234 ### i_func_X_neg(): $i
235 my $path_object = $self->{'planepath_object'};
236 return $path_object->xy_to_n (-$i * $self->{'i_step'},
237 $path_object->_NumSeq_X_axis_at_Y);
238 }
239 sub i_func_Y_neg {
240 my ($self, $i) = @_;
241 my $path_object = $self->{'planepath_object'};
242 return $path_object->xy_to_n ($path_object->_NumSeq_Y_axis_at_X,
243 - $i * $self->{'i_step'});
244 }
245 sub i_func_Diagonal {
246 my ($self, $i) = @_;
247 my $path_object = $self->{'planepath_object'};
248 return $path_object->xy_to_n ($i + $path_object->_NumSeq_Diagonal_X_offset,
249 $i);
250 }
251 sub i_func_Diagonal_NW {
252 my ($self, $i) = @_;
253 my $path_object = $self->{'planepath_object'};
254 return $path_object->xy_to_n (-$i + $path_object->_NumSeq_Diagonal_X_offset,
255 $i);
256 }
257 sub i_func_Diagonal_SW {
258 my ($self, $i) = @_;
259 my $path_object = $self->{'planepath_object'};
260 return $path_object->xy_to_n (-$i + $path_object->_NumSeq_Diagonal_X_offset,
261 -$i);
262 }
263 sub i_func_Diagonal_SE {
264 my ($self, $i) = @_;
265 my $path_object = $self->{'planepath_object'};
266 return $path_object->xy_to_n ($i + $path_object->_NumSeq_Diagonal_X_offset,
267 -$i);
268 }
269  
270 sub i_func_Depth_start {
271 my ($self, $i) = @_;
272 ### i_func_Depth_start(): "i=$i"
273 return $self->{'planepath_object'}->tree_depth_to_n($i);
274 }
275 sub i_func_Depth_end {
276 my ($self, $i) = @_;
277 return $self->{'planepath_object'}->tree_depth_to_n_end($i);
278 }
279  
280 #------------------------------------------------------------------------------
281  
282 sub pred {
283 my ($self, $value) = @_;
284 ### PlanePathN pred(): $value
285 my $planepath_object = $self->{'planepath_object'};
286 unless ($value == int($value)) {
287 return 0;
288 }
289 my ($x,$y) = $planepath_object->n_to_xy($value)
290 or return 0;
291 return &{$self->{'pred_func'}} ($self, $x,$y, $value);
292 }
293 sub pred_func_X_axis {
294 my ($self, $x,$y) = @_;
295 return ($x >= $self->{'i_start'}
296 && $y == $self->{'planepath_object'}->_NumSeq_X_axis_at_Y);
297 }
298 sub pred_func_Y_axis {
299 my ($self, $x,$y) = @_;
300 return ($x == $self->{'planepath_object'}->_NumSeq_Y_axis_at_X
301 && $y >= $self->{'i_start'});
302 }
303 sub pred_func_X_neg {
304 my ($self, $x,$y) = @_;
305 return ($x <= - $self->{'i_start'} && $y == 0);
306 }
307 sub pred_func_Y_neg {
308 my ($self, $x,$y) = @_;
309 return ($x == 0 && $y <= - $self->{'i_start'});
310 }
311 sub pred_func_Diagonal {
312 my ($self, $x,$y) = @_;
313 $x -= $self->{'planepath_object'}->_NumSeq_Diagonal_X_offset;
314 return ($x >= $self->{'i_start'} && $x == $y);
315 }
316 sub pred_func_Diagonal_NW {
317 my ($self, $x,$y) = @_;
318 return ($x <= - $self->{'i_start'} && $x == -$y);
319 }
320 sub pred_func_Diagonal_SW {
321 my ($self, $x,$y) = @_;
322 return ($x <= - $self->{'i_start'} && $x == $y);
323 }
324 sub pred_func_Diagonal_SE {
325 my ($self, $x,$y) = @_;
326 return ($x >= $self->{'i_start'} && $x == -$y);
327 }
328  
329 sub pred_func_Depth_start {
330 my ($self, $x,$y, $n) = @_;
331 return path_tree_n_is_depth_start($self->{'planepath_object'}, $n);
332 }
333 sub pred_func_Depth_end {
334 my ($self, $x,$y, $n) = @_;
335 return path_tree_n_is_depth_end($self->{'planepath_object'}, $n);
336 }
337  
338 # Return true if $n is the start of a depth level.
339 sub path_tree_n_is_depth_start {
340 my ($path, $n) = @_;
341 my $depth = $path->tree_n_to_depth($n);
342 return (defined $depth && $n == $path->tree_depth_to_n($depth));
343 }
344 # Return true if $n is the end of a depth level.
345 sub path_tree_n_is_depth_end {
346 my ($path, $n) = @_;
347 my $depth = $path->tree_n_to_depth($n);
348 return (defined $depth && $n == $path->tree_depth_to_n_end($depth));
349 }
350  
351 #------------------------------------------------------------------------------
352  
353 use constant characteristic_integer => 1; # integer Ns
354  
355 sub characteristic_increasing {
356 my ($self) = @_;
357 ### PlanePathN characteristic_increasing(): $self
358  
359 my $method = "_NumSeq_$self->{'line_type'}_increasing";
360 my $planepath_object = $self->{'planepath_object'};
361  
362 ### planepath_object: ref $planepath_object
363 ### $method
364 ### can code: $planepath_object->can($method)
365 ### result: $planepath_object->can($method) && $planepath_object->$method()
366  
367 return $planepath_object->can($method) && $planepath_object->$method();
368 }
369 sub characteristic_increasing_from_i {
370 my ($self) = @_;
371 ### PlanePathN characteristic_increasing_from_i(): $self
372  
373 my $planepath_object = $self->{'planepath_object'};
374 my $method = "_NumSeq_$self->{'line_type'}_increasing_from_i";
375 ### $method
376  
377 if ($method = $planepath_object->can($method)) {
378 ### can: $method
379 return $planepath_object->$method();
380 }
381 return ($self->characteristic('increasing')
382 ? $self->i_start
383 : undef);
384 }
385  
386 sub characteristic_non_decreasing {
387 my ($self) = @_;
388 ### PlanePathN characteristic_non_decreasing() ...
389 my $planepath_object = $self->{'planepath_object'};
390 my $method = "_NumSeq_$self->{'line_type'}_non_decreasing";
391 return (($planepath_object->can($method) && $planepath_object->$method())
392 || $self->characteristic_increasing);
393 }
394  
395 sub values_min {
396 my ($self) = @_;
397 ### PlanePathN values_min() ...
398 my $method = "_NumSeq_$self->{'line_type'}_min";
399 my $planepath_object = $self->{'planepath_object'};
400 if (my $coderef = $planepath_object->can($method)) {
401 ### $coderef
402 return $planepath_object->$coderef();
403 }
404 return $self->ith($self->i_start);
405 }
406 sub values_max {
407 my ($self) = @_;
408 my $method = "_NumSeq_$self->{'line_type'}_max";
409 my $planepath_object = $self->{'planepath_object'};
410 if (my $coderef = $planepath_object->can($method)) {
411 return $planepath_object->$coderef();
412 }
413 return undef;
414 }
415  
416 { package Math::PlanePath;
417 sub _NumSeq_X_axis_i_start {
418 my ($self) = @_;
419 my $x_minimum = $self->x_minimum;
420 if (defined $x_minimum && $x_minimum > 0) {
421 return int($x_minimum);
422 }
423 return 0;
424 }
425 sub _NumSeq_Y_axis_i_start {
426 my ($self) = @_;
427 ### _NumSeq_Y_axis_i_start() ...
428 my $y_minimum = $self->y_minimum;
429 if (defined $y_minimum && $y_minimum > 0) {
430 return int($y_minimum);
431 }
432 return 0;
433 }
434 sub _NumSeq_Y_axis_at_X {
435 my ($self) = @_;
436 my $x_minimum = $self->x_minimum;
437 if (defined $x_minimum && $x_minimum > 0) {
438 return $x_minimum;
439 }
440 return 0;
441 }
442 sub _NumSeq_X_axis_at_Y {
443 my ($self) = @_;
444 my $y_minimum = $self->y_minimum;
445 if (defined $y_minimum && $y_minimum > 0) {
446 return $y_minimum;
447 }
448 return 0;
449 }
450  
451 # i_start = Xminimum - Xoffset
452 # gives Xstart = i_start + Xoffset = Xminimum to start at Xminimum
453 use List::Util;
454 sub _NumSeq_Diagonal_i_start {
455 my ($self) = @_;
456 my $x_minimum = $self->x_minimum;
457 my $y_minimum = $self->y_minimum;
458 return List::Util::max
459 (int(($x_minimum||0) - $self->_NumSeq_Diagonal_X_offset),
460 int($y_minimum||0),
461 0);
462 }
463 use constant _NumSeq_Diagonal_X_offset => 0;
464 use constant _NumSeq_N_oeis_anum => {};
465 use constant _NumSeq_N_oeis_all_anum => {};
466 use constant _NumSeq_Depth_start_increasing => 1;
467 use constant _NumSeq_Depth_end_increasing => 1;
468  
469 # sub _NumSeq_pred_X_axis {
470 # my ($path, $value) = @_;
471 # return ($value == int($value)
472 # && ($path->x_negative || $value >= 0));
473 # }
474 # sub _NumSeq_pred_Y_axis {
475 # my ($path, $value) = @_;
476 # return ($value == int($value)
477 # && ($path->y_negative || $value >= 0));
478 # }
479 }
480  
481 { package Math::PlanePath::SquareSpiral;
482 use constant _NumSeq_X_axis_increasing => 1;
483 use constant _NumSeq_Y_axis_increasing => 1;
484 sub _NumSeq_X_neg_increasing {
485 my ($self) = @_;
486 return ($self->{'wider'} == 0);
487 }
488 sub _NumSeq_X_neg_increasing_from_i {
489 my ($self) = @_;
490 ### SquareSpiral _NumSeq_X_neg_increasing_from_i(): $self
491 # wider=0 from X=0
492 # wider=1 from X=-1
493 # wider=2 from X=-1
494 return int(($self->{'wider'}+1)/2);
495 }
496 use constant _NumSeq_Y_neg_increasing => 1;
497 use constant _NumSeq_Diagonal_increasing => 1;
498 use constant _NumSeq_Diagonal_NW_increasing => 1;
499 use constant _NumSeq_Diagonal_SW_increasing => 1;
500 use constant _NumSeq_Diagonal_SE_increasing => 1;
501  
502 sub _NumSeq_X_neg_min { # not the value at X=0,Y=0 if wider>0
503 my ($self) = @_;
504 return $self->n_start;
505 }
506  
507 use constant _NumSeq_N_oeis_anum =>
508 { 'wider=0,n_start=1' =>
509 { X_axis => 'A054552', # spoke E, 4n^2 - 3n + 1
510 Y_neg => 'A033951', # spoke S, 4n^2 + 3n + 1
511 Diagonal_NW => 'A053755', # 4n^2 + 1
512 Diagonal_SE => 'A016754', # (2n+1)^2
513 # OEIS-Catalogue: A054552 planepath=SquareSpiral
514 # OEIS-Catalogue: A033951 planepath=SquareSpiral line_type=Y_neg
515 # OEIS-Catalogue: A053755 planepath=SquareSpiral line_type=Diagonal_NW
516 # OEIS-Catalogue: A016754 planepath=SquareSpiral line_type=Diagonal_SE
517 #
518 # OEIS-Other: A054552 planepath=GreekKeySpiral,turns=0
519 # OEIS-Other: A033951 planepath=GreekKeySpiral,turns=0 line_type=Y_neg
520 # OEIS-Other: A053755 planepath=GreekKeySpiral,turns=0 line_type=Diagonal_NW
521 # OEIS-Other: A016754 planepath=GreekKeySpiral,turns=0 line_type=Diagonal_SE
522  
523 # Not quite, these have OFFSET=1 whereas path start X=0
524 # # Y_axis => 'A054556', # spoke N
525 # # X_neg => 'A054567', # spoke W
526 # # Diagonal => 'A054554', # spoke NE
527 # # Diagonal_SW => 'A054569', # spoke NE
528 # # # OEIS-Catalogue: A054556 planepath=SquareSpiral line_type=Y_axis
529 # # # OEIS-Catalogue: A054554 planepath=SquareSpiral line_type=Diagonal
530 },
531 'wider=0,n_start=0' =>
532 { X_axis => 'A001107',
533 Y_axis => 'A033991',
534 Y_neg => 'A033954', # second 10-gonals
535 Diagonal => 'A002939',
536 Diagonal_NW => 'A016742', # 10-gonals average, 4*n^2
537 Diagonal_SW => 'A002943',
538 # OEIS-Other: A001107 planepath=SquareSpiral,n_start=0
539 # OEIS-Catalogue: A033991 planepath=SquareSpiral,n_start=0 line_type=Y_axis
540 # OEIS-Other: A033954 planepath=SquareSpiral,n_start=0 line_type=Y_neg
541 # OEIS-Catalogue: A002939 planepath=SquareSpiral,n_start=0 line_type=Diagonal
542 # OEIS-Other: A016742 planepath=SquareSpiral,n_start=0 line_type=Diagonal_NW
543 # OEIS-Catalogue: A002943 planepath=SquareSpiral,n_start=0 line_type=Diagonal_SW
544 },
545  
546 'wider=1,n_start=1' =>
547 { Diagonal_SW => 'A069894',
548 # OEIS-Catalogue: A069894 planepath=SquareSpiral,wider=1 line_type=Diagonal_SW
549 },
550 'wider=1,n_start=0' =>
551 { Diagonal_SW => 'A016754', # odd squares
552 # OEIS-Other: A016754 planepath=SquareSpiral,wider=1,n_start=0 line_type=Diagonal_SW
553 },
554 };
555 }
556 { package Math::PlanePath::GreekKeySpiral;
557 use constant _NumSeq_X_axis_increasing => 1;
558 use constant _NumSeq_Y_axis_increasing => 1;
559 sub _NumSeq_X_neg_increasing {
560 my ($self) = @_;
561 return ($self->{'turns'} == 0); # when SquareSpiral style
562 }
563 *_NumSeq_Y_neg_increasing = \&_NumSeq_X_neg_increasing;
564 sub _NumSeq_Diagonal_increasing {
565 my ($self) = @_;
566 return ($self->{'turns'} <= 1);
567 }
568 sub _NumSeq_Diagonal_NW_increasing {
569 my ($self) = @_;
570 return ($self->{'turns'} == 0);
571 }
572 *_NumSeq_Diagonal_SW_increasing = \&_NumSeq_Diagonal_increasing;
573 sub _NumSeq_Diagonal_SE_increasing {
574 my ($self) = @_;
575 return ($self->{'turns'} <= 2);
576 }
577  
578 use constant _NumSeq_N_oeis_anum =>
579 { 'turns=0' =>
580 (Math::PlanePath::SquareSpiral
581 ->_NumSeq_N_oeis_anum->{'wider=0,n_start=1'}
582 || die "Oops, SquareSpiral NumSeq PlanePathN not found"),
583 };
584 }
585 { package Math::PlanePath::PyramidSpiral;
586 use constant _NumSeq_X_axis_increasing => 1;
587 use constant _NumSeq_Y_axis_increasing => 1;
588 use constant _NumSeq_X_neg_increasing => 1;
589 use constant _NumSeq_Y_neg_increasing => 1;
590 use constant _NumSeq_Diagonal_increasing => 1;
591 use constant _NumSeq_Diagonal_NW_increasing => 1;
592 use constant _NumSeq_Diagonal_SW_increasing => 1;
593 use constant _NumSeq_Diagonal_SE_increasing => 1;
594  
595 use constant _NumSeq_N_oeis_anum =>
596 { 'n_start=1' =>
597 { X_axis => 'A054552', # square spiral spoke E, 4n^2 - 3n + 1
598 Diagonal_SE => 'A033951', # square spiral spoke S, 4n^2 + 3n + 1
599 # OEIS-Other: A054552 planepath=PyramidSpiral
600 # OEIS-Other: A033951 planepath=PyramidSpiral line_type=Diagonal_SE
601 },
602 'n_start=0' =>
603 { X_axis => 'A001107', # decagonal
604 Y_axis => 'A002939',
605 X_neg => 'A033991',
606 Y_neg => 'A002943',
607 Diagonal_SW => 'A007742',
608 Diagonal_SE => 'A033954', # decagonal second kind
609 # OEIS-Other: A001107 planepath=PyramidSpiral,n_start=0
610 # OEIS-Other: A002939 planepath=PyramidSpiral,n_start=0 line_type=Y_axis
611 # OEIS-Other: A033991 planepath=PyramidSpiral,n_start=0 line_type=X_neg
612 # OEIS-Other: A002943 planepath=PyramidSpiral,n_start=0 line_type=Y_neg
613 # OEIS-Other: A007742 planepath=PyramidSpiral,n_start=0 line_type=Diagonal_SW
614 # OEIS-Other: A033954 planepath=PyramidSpiral,n_start=0 line_type=Diagonal_SE
615 },
616 'n_start=2' =>
617 { Diagonal_SE => 'A185669',
618 # OEIS-Catalogue: A185669 planepath=PyramidSpiral,n_start=2 line_type=Diagonal_SE
619 },
620 };
621 }
622 { package Math::PlanePath::TriangleSpiral;
623 use constant _NumSeq_X_axis_increasing => 1;
624 use constant _NumSeq_Y_axis_increasing => 1;
625 use constant _NumSeq_X_neg_increasing => 1;
626 use constant _NumSeq_Y_neg_increasing => 1;
627 use constant _NumSeq_Diagonal_increasing => 1;
628 use constant _NumSeq_Diagonal_NW_increasing => 1;
629 use constant _NumSeq_Diagonal_SW_increasing => 1;
630 use constant _NumSeq_Diagonal_SE_increasing => 1;
631  
632 use constant _NumSeq_N_oeis_anum =>
633 { 'n_start=1' =>
634 { X_axis => 'A117625', # step by 2 each time
635 Y_neg => 'A006137', # step by 2 each time
636 Diagonal_SW => 'A064225',
637 Diagonal_SE => 'A081267',
638 # OEIS-Other: A117625 planepath=TriangleSpiral
639 # OEIS-Other: A064225 planepath=TriangleSpiral line_type=Diagonal_SW
640 # OEIS-Other: A081267 planepath=TriangleSpiral line_type=Diagonal_SE
641  
642 # # Not quite, starts value=3 at n=0 which is path Y=1
643 # Diagonal => 'A064226', # and duplicate in A081269
644 },
645 'n_start=0' =>
646 { Y_axis => 'A062741', # 3*pentagonal, Y even
647 Diagonal => 'A062708', # reading in direction 0,2,...
648 Diagonal_SW => 'A062725', # reading in direction 0,7,...
649 Diagonal_SE => 'A062728', # 11-gonal "second" per Math::NumSeq::Polygonal
650 # OEIS-Catalogue: A062741 planepath=TriangleSpiral,n_start=0 line_type=Y_axis
651 # OEIS-Catalogue: A062708 planepath=TriangleSpiral,n_start=0 line_type=Diagonal
652 # OEIS-Catalogue: A062725 planepath=TriangleSpiral,n_start=0 line_type=Diagonal_SW
653 # OEIS-Other: A062728 planepath=TriangleSpiral,n_start=0 line_type=Diagonal_SE
654  
655 # but spaced 2 apart ...
656 # X_axis => 'A051682', # 11-gonals per Math::NumSeq::Polygonal
657 # # OEIS-Other: A051682 planepath=TriangleSpiral,n_start=0 # X_axis
658 },
659 };
660 }
661 { package Math::PlanePath::TriangleSpiralSkewed;
662 use constant _NumSeq_X_axis_increasing => 1;
663 use constant _NumSeq_Y_axis_increasing => 1;
664 use constant _NumSeq_X_neg_increasing => 1;
665 use constant _NumSeq_Y_neg_increasing => 1;
666 use constant _NumSeq_Diagonal_increasing => 1;
667 use constant _NumSeq_Diagonal_NW_increasing => 1;
668 use constant _NumSeq_Diagonal_SW_increasing => 1;
669 use constant _NumSeq_Diagonal_SE_increasing => 1;
670  
671 # ENHANCE-ME: All these variously rotated for skew=right,up,down
672 use constant _NumSeq_N_oeis_anum =>
673 { 'skew=left,n_start=1' =>
674 { X_axis => 'A117625',
675 X_neg => 'A006137',
676 Y_neg => 'A064225',
677 Diagonal => 'A081589',
678 Diagonal_SW => 'A038764',
679 Diagonal_SE => 'A081267',
680 # OEIS-Catalogue: A117625 planepath=TriangleSpiralSkewed
681 # OEIS-Catalogue: A006137 planepath=TriangleSpiralSkewed line_type=X_neg
682 # OEIS-Catalogue: A064225 planepath=TriangleSpiralSkewed line_type=Y_neg
683 # OEIS-Catalogue: A081589 planepath=TriangleSpiralSkewed line_type=Diagonal
684 # OEIS-Catalogue: A038764 planepath=TriangleSpiralSkewed line_type=Diagonal_SW
685 # OEIS-Catalogue: A081267 planepath=TriangleSpiralSkewed line_type=Diagonal_SE
686 # OEIS-Catalogue: A081274 planepath=TriangleSpiralSkewed line_type=Diagonal_SW
687  
688 # # Not quite, starts OFFSET=0 value=3 but that is at path Y=1
689 # Y_axis => 'A064226', # and duplicate in A081269
690 },
691 'skew=left,n_start=0' =>
692 { X_axis => 'A051682', # 11-gonals per Math::NumSeq::Polygonal
693 Y_axis => 'A062708', # reading in direction 0,2,...
694 Y_neg => 'A062725', # reading in direction 0,7,...
695 Diagonal_SE => 'A062728', # 11-gonal "second" per Math::NumSeq::Polygonal
696 Diagonal_SW => 'A081266',
697 # OEIS-Other: A051682 planepath=TriangleSpiralSkewed,n_start=0 # X_axis
698 # OEIS-Other: A062708 planepath=TriangleSpiralSkewed,n_start=0 line_type=Y_axis
699 # OEIS-Other: A062725 planepath=TriangleSpiralSkewed,n_start=0 line_type=Y_neg
700 # OEIS-Other: A062728 planepath=TriangleSpiralSkewed,n_start=0 line_type=Diagonal_SE
701 # OEIS-Catalogue: A081266 planepath=TriangleSpiralSkewed,n_start=0 line_type=Diagonal_SW
702 },
703 };
704 }
705 { package Math::PlanePath::DiamondSpiral;
706 use constant _NumSeq_X_axis_increasing => 1;
707 use constant _NumSeq_Y_axis_increasing => 1;
708 use constant _NumSeq_X_neg_increasing => 1;
709 use constant _NumSeq_Y_neg_increasing => 1;
710 use constant _NumSeq_Diagonal_increasing => 1;
711 use constant _NumSeq_Diagonal_NW_increasing => 1;
712 use constant _NumSeq_Diagonal_SW_increasing => 1;
713 use constant _NumSeq_Diagonal_SE_increasing => 1;
714  
715 use constant _NumSeq_N_oeis_anum =>
716 { 'n_start=1' =>
717 { X_axis => 'A130883', # 2*n^2-n+1
718 X_neg => 'A084849', # 2*n^2+n+1
719 Y_axis => 'A058331', # 2*n^2 + 1
720 Y_neg => 'A001844', # centred squares 2n(n+1)+1
721 # OEIS-Catalogue: A130883 planepath=DiamondSpiral
722 # OEIS-Other: A084849 planepath=DiamondSpiral line_type=X_neg
723 # OEIS-Catalogue: A058331 planepath=DiamondSpiral line_type=Y_axis
724 # OEIS-Other: A001844 planepath=DiamondSpiral line_type=Y_neg
725 },
726 'n_start=0' =>
727 { X_axis => 'A000384', # 2*n^2-n, hexagonal numbers
728 X_neg => 'A014105', # 2*n^2+n, hexagonal numbers second kind
729 Y_axis => 'A001105', # 2*n^2
730 Y_neg => 'A046092', # 2n(n+1) = 4*triangular
731 # OEIS-Other: A000384 planepath=DiamondSpiral,n_start=0
732 # OEIS-Other: A014105 planepath=DiamondSpiral,n_start=0 line_type=X_neg
733 # OEIS-Other: A001105 planepath=DiamondSpiral,n_start=0 line_type=Y_axis
734 # OEIS-Other: A046092 planepath=DiamondSpiral,n_start=0 line_type=Y_neg
735 },
736 };
737 }
738 { package Math::PlanePath::DiamondArms;
739 use constant _NumSeq_X_axis_increasing => 1;
740 use constant _NumSeq_Y_axis_increasing => 1;
741 use constant _NumSeq_X_neg_increasing => 1;
742 use constant _NumSeq_Y_neg_increasing => 1;
743 use constant _NumSeq_Diagonal_increasing => 1;
744 use constant _NumSeq_Diagonal_NW_increasing => 1;
745 use constant _NumSeq_Diagonal_SW_increasing => 1;
746 use constant _NumSeq_Diagonal_SE_increasing => 1;
747 }
748 { package Math::PlanePath::AztecDiamondRings;
749 use constant _NumSeq_X_axis_increasing => 1;
750 use constant _NumSeq_Y_axis_increasing => 1;
751 use constant _NumSeq_X_neg_increasing => 1;
752 use constant _NumSeq_Y_neg_increasing => 1;
753 use constant _NumSeq_Diagonal_increasing => 1;
754 use constant _NumSeq_Diagonal_NW_increasing => 1;
755 use constant _NumSeq_Diagonal_SW_increasing => 1;
756 use constant _NumSeq_Diagonal_SE_increasing => 1;
757  
758 use constant _NumSeq_N_oeis_anum =>
759 { 'n_start=1' =>
760 { X_axis => 'A001844', # centred squares 2n(n+1)+1
761 # OEIS-Other: A001844 planepath=AztecDiamondRings
762  
763 # Not quite, A000384 has extra value=0
764 # Y_axis => 'A000384', # hexagonal numbers
765 },
766 'n_start=0' =>
767 { X_axis => 'A046092', # 4*triangular
768 Diagonal => 'A139277', # x*(8*x+5)
769 # OEIS-Other: A046092 planepath=AztecDiamondRings,n_start=0
770 # OEIS-Other: A139277 planepath=AztecDiamondRings,n_start=0 line_type=Diagonal
771 },
772 };
773 }
774 { package Math::PlanePath::PentSpiral;
775 use constant _NumSeq_X_axis_step => 2;
776 use constant _NumSeq_X_axis_increasing => 1;
777 use constant _NumSeq_Y_axis_increasing => 1;
778 use constant _NumSeq_X_neg_increasing => 1;
779 use constant _NumSeq_Y_neg_increasing => 1;
780 use constant _NumSeq_Diagonal_increasing => 1;
781 use constant _NumSeq_Diagonal_NW_increasing => 1;
782 use constant _NumSeq_Diagonal_SW_increasing => 1;
783 use constant _NumSeq_Diagonal_SE_increasing => 1;
784  
785 use constant _NumSeq_N_oeis_anum =>
786 { 'n_start=1' =>
787 { X_axis => 'A192136', # (5*n^2-3*n+2)/2
788 X_neg => 'A116668', # (5n^2 + n + 2)/2
789 Diagonal_SE => 'A005891', # centred pentagonal (5n^2+5n+2)/2
790 # OEIS-Other: A192136 planepath=PentSpiral
791 # OEIS-Other: A116668 planepath=PentSpiral line_type=X_neg
792 # OEIS-Other: A005891 planepath=PentSpiral line_type=Diagonal_SE
793  
794 # Not quite, A134238 OFFSET=1 vs start X=0 here
795 # Diagonal_SW => 'A134238',
796 },
797  
798 'n_start=0' =>
799 { X_axis => 'A000566', # heptagonals
800 Y_axis => 'A005476',
801 Diagonal_SE => 'A028895', # 5*triangular
802 # OEIS-Other: A000566 planepath=PentSpiral,n_start=0
803 # OEIS-Other: A005476 planepath=PentSpiral,n_start=0 line_type=Y_axis
804 # OEIS-Other: A028895 planepath=PentSpiral,n_start=0 line_type=Diagonal_SE
805 },
806 };
807 }
808 { package Math::PlanePath::PentSpiralSkewed;
809 use constant _NumSeq_X_axis_increasing => 1;
810 use constant _NumSeq_Y_axis_increasing => 1;
811 use constant _NumSeq_X_neg_increasing => 1;
812 use constant _NumSeq_Y_neg_increasing => 1;
813 use constant _NumSeq_Diagonal_increasing => 1;
814 use constant _NumSeq_Diagonal_NW_increasing => 1;
815 use constant _NumSeq_Diagonal_SW_increasing => 1;
816 use constant _NumSeq_Diagonal_SE_increasing => 1;
817  
818 use constant _NumSeq_N_oeis_anum =>
819 { 'n_start=1' =>
820 { X_axis => 'A192136', # (5*n^2-3*n+2)/2
821 X_neg => 'A116668', # (5n^2 + n + 2)/2
822 Diagonal_NW => 'A158187', # 10*n^2 + 1
823 Diagonal_SE => 'A005891', # centred pentagonal (5n^2+5n+2)/2
824 # OEIS-Catalogue: A192136 planepath=PentSpiralSkewed
825 # OEIS-Catalogue: A116668 planepath=PentSpiralSkewed line_type=X_neg
826 # OEIS-Catalogue: A158187 planepath=PentSpiralSkewed line_type=Diagonal_NW
827 # OEIS-Catalogue: A005891 planepath=PentSpiralSkewed line_type=Diagonal_SE
828  
829 # Not quite, A140066 OFFSET=1 but path start Y=0 here
830 # Y_axis => 'A140066', # (5n^2-11n+8)/2 but from Y=0 so using (n-1)
831  
832 # Not quite, A134238 OFFSET=1 but path start Y=0 here
833 # Y_neg => 'A134238',
834 # # OEIS-Catalogue: A134238 planepath=PentSpiralSkewed line_type=Y_neg
835 },
836  
837 'n_start=0' =>
838 { X_axis => 'A000566', # heptagonals
839 Y_axis => 'A005476',
840 X_neg => 'A005475',
841 Diagonal_NW => 'A033583', # 10*n^2
842 Diagonal_SE => 'A028895', # 5*triangular
843 # OEIS-Other: A000566 planepath=PentSpiralSkewed,n_start=0
844 # OEIS-Catalogue: A005476 planepath=PentSpiralSkewed,n_start=0 line_type=Y_axis
845 # OEIS-Catalogue: A005475 planepath=PentSpiralSkewed,n_start=0 line_type=X_neg
846 # OEIS-Other: A033583 planepath=PentSpiralSkewed,n_start=0 line_type=Diagonal_NW
847 # OEIS-Catalogue: A028895 planepath=PentSpiralSkewed,n_start=0 line_type=Diagonal_SE
848  
849 # Not quite, A147875 OFFSET=1 vs start Y=0 here
850 # Y_neg => 'A147875', # second heptagonals
851 # # OEIS-Other: A147875 planepath=PentSpiralSkewed,n_start=0 line_type=Y_neg
852 },
853 };
854 }
855 { package Math::PlanePath::HexSpiral;
856 use constant _NumSeq_X_axis_increasing => 1;
857 use constant _NumSeq_Y_axis_increasing => 1;
858 *_NumSeq_X_neg_increasing
859 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_increasing;
860 *_NumSeq_X_neg_increasing_from_i
861 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_increasing_from_i;
862 *_NumSeq_X_neg_min
863 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_min;
864 use constant _NumSeq_Y_neg_increasing => 1;
865 use constant _NumSeq_Diagonal_increasing => 1;
866 use constant _NumSeq_Diagonal_NW_increasing => 1;
867 use constant _NumSeq_Diagonal_SW_increasing => 1;
868 use constant _NumSeq_Diagonal_SE_increasing => 1;
869  
870 use constant _NumSeq_N_oeis_anum =>
871 { 'wider=0,n_start=1' =>
872 { X_axis => 'A056105', # first spoke 3n^2-2n+1
873 Diagonal => 'A056106', # second spoke 3n^2-n+1
874 Diagonal_NW => 'A056107', # third spoke 3n^2+1
875 X_neg => 'A056108', # fourth spoke 3n^2+n+1
876 Diagonal_SW => 'A056109', # fifth spoke 3n^2+2n+1
877 Diagonal_SE => 'A003215', # centred hexagonal numbers
878 # OEIS-Other: A056105 planepath=HexSpiral
879 # OEIS-Other: A056106 planepath=HexSpiral line_type=Diagonal
880 # OEIS-Other: A056107 planepath=HexSpiral line_type=Diagonal_NW
881 # OEIS-Other: A056108 planepath=HexSpiral line_type=X_neg
882 # OEIS-Other: A056109 planepath=HexSpiral line_type=Diagonal_SW
883 # OEIS-Other: A003215 planepath=HexSpiral line_type=Diagonal_SE
884 },
885 'wider=0,n_start=0' =>
886 { X_axis => 'A000567', # octagonal numbers
887 X_neg => 'A049451',
888 Diagonal => 'A049450',
889 Diagonal_NW => 'A033428', # octagonal numbers first,second average
890 Diagonal_SW => 'A045944', # octagonal numbers second
891 Diagonal_SE => 'A028896',
892 # OEIS-Other: A000567 planepath=HexSpiral,n_start=0
893 # OEIS-Other: A049451 planepath=HexSpiral,n_start=0 line_type=X_neg
894 # OEIS-Catalogue: A049450 planepath=HexSpiral,n_start=0 line_type=Diagonal
895 # OEIS-Other: A033428 planepath=HexSpiral,n_start=0 line_type=Diagonal_NW
896 # OEIS-Other: A045944 planepath=HexSpiral,n_start=0 line_type=Diagonal_SW
897 # OEIS-Catalogue: A028896 planepath=HexSpiral,n_start=0 line_type=Diagonal_SE
898 },
899 };
900 }
901 { package Math::PlanePath::HexSpiralSkewed;
902 use constant _NumSeq_X_axis_increasing => 1;
903 use constant _NumSeq_Y_axis_increasing => 1;
904 *_NumSeq_X_neg_increasing
905 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_increasing;
906 *_NumSeq_X_neg_increasing_from_i
907 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_increasing_from_i;
908 *_NumSeq_X_neg_min
909 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_min;
910 use constant _NumSeq_Y_neg_increasing => 1;
911 use constant _NumSeq_Diagonal_increasing => 1;
912 use constant _NumSeq_Diagonal_NW_increasing => 1;
913 use constant _NumSeq_Diagonal_SW_increasing => 1;
914 use constant _NumSeq_Diagonal_SE_increasing => 1;
915  
916 use constant _NumSeq_N_oeis_anum =>
917 { 'wider=0,n_start=1' =>
918 { X_axis => 'A056105', # first spoke 3n^2-2n+1
919 Y_axis => 'A056106', # second spoke 3n^2-n+1
920 Diagonal_NW => 'A056107', # third spoke 3n^2+1
921 X_neg => 'A056108', # fourth spoke 3n^2+n+1
922 Y_neg => 'A056109', # fifth spoke 3n^2+2n+1
923 Diagonal_SE => 'A003215', # centred hexagonal numbers
924 # OEIS-Catalogue: A056105 planepath=HexSpiralSkewed
925 # OEIS-Catalogue: A056106 planepath=HexSpiralSkewed line_type=Y_axis
926 # OEIS-Catalogue: A056108 planepath=HexSpiralSkewed line_type=X_neg
927 # OEIS-Catalogue: A056109 planepath=HexSpiralSkewed line_type=Y_neg
928 # OEIS-Catalogue: A056107 planepath=HexSpiralSkewed line_type=Diagonal_NW
929 # OEIS-Other: A003215 planepath=HexSpiralSkewed line_type=Diagonal_SE
930 },
931 'wider=0,n_start=0' =>
932 { X_axis => 'A000567', # octagonal numbers
933 Y_axis => 'A049450',
934 X_neg => 'A049451',
935 Y_neg => 'A045944', # octagonal numbers second
936 Diagonal => 'A062783',
937 Diagonal_NW => 'A033428', # octagonal numbers first,second average
938 Diagonal_SW => 'A063436',
939 Diagonal_SE => 'A028896',
940 # OEIS-Other: A000567 planepath=HexSpiralSkewed,n_start=0
941 # OEIS-Other: A049450 planepath=HexSpiralSkewed,n_start=0 line_type=Y_axis
942 # OEIS-Catalogue: A049451 planepath=HexSpiralSkewed,n_start=0 line_type=X_neg
943 # OEIS-Other: A045944 planepath=HexSpiralSkewed,n_start=0 line_type=Y_neg
944 # OEIS-Catalogue: A062783 planepath=HexSpiralSkewed,n_start=0 line_type=Diagonal
945 # OEIS-Other: A033428 planepath=HexSpiralSkewed,n_start=0 line_type=Diagonal_NW
946 # OEIS-Catalogue: A063436 planepath=HexSpiralSkewed,n_start=0 line_type=Diagonal_SW
947 # OEIS-Other: A028896 planepath=HexSpiralSkewed,n_start=0 line_type=Diagonal_SE
948 },
949  
950 # wider=1 X_axis almost 3*n^2 but not initial X=0 value
951 # wider=1 Y_axis almost A049451 twice pentagonal but not initial X=0
952 # wider=2 Y_axis almost A028896 6*triangular but not initial Y=0
953 };
954 }
955 { package Math::PlanePath::HexArms;
956 use constant _NumSeq_X_axis_increasing => 1;
957 use constant _NumSeq_Y_axis_increasing => 1;
958 use constant _NumSeq_X_neg_increasing => 1;
959 use constant _NumSeq_Y_neg_increasing => 1;
960 use constant _NumSeq_Diagonal_increasing => 1;
961 use constant _NumSeq_Diagonal_NW_increasing => 1;
962 use constant _NumSeq_Diagonal_SW_increasing => 1;
963 use constant _NumSeq_Diagonal_SE_increasing => 1;
964 }
965 { package Math::PlanePath::HeptSpiralSkewed;
966 use constant _NumSeq_X_axis_increasing => 1;
967 use constant _NumSeq_Y_axis_increasing => 1;
968 use constant _NumSeq_X_neg_increasing => 1;
969 use constant _NumSeq_Y_neg_increasing => 1;
970 use constant _NumSeq_Diagonal_increasing => 1;
971 use constant _NumSeq_Diagonal_NW_increasing => 1;
972 use constant _NumSeq_Diagonal_SW_increasing => 1;
973 use constant _NumSeq_Diagonal_SE_increasing => 1;
974  
975 use constant _NumSeq_N_oeis_anum =>
976 {
977 # 'n_start=1' =>
978 # {
979 # # Not quite, OFFSET=1 vs path start X=Y=0
980 # # Y_axis => 'A140065', # (7n^2 - 17n + 12)/2 but starting Y=0 not n=1
981 # # Diagonal_NW => 'A140063',
982 # # Diagonal_SE => 'A069099',
983 # },
984  
985 'n_start=0' =>
986 { X_axis => 'A001106', # 9-gonals
987 Y_axis => 'A218471',
988 X_neg => 'A022265',
989 Y_neg => 'A179986', # second 9-gonals
990 Diagonal => 'A195023',
991 Diagonal_NW => 'A022264',
992 Diagonal_SW => 'A186029',
993 Diagonal_SE => 'A024966',
994 # OEIS-Other: A001106 planepath=HeptSpiralSkewed,n_start=0
995 # OEIS-Catalogue: A022265 planepath=HeptSpiralSkewed,n_start=0 line_type=X_neg
996 # OEIS-Catalogue: A218471 planepath=HeptSpiralSkewed,n_start=0 line_type=Y_axis
997 # OEIS-Other: A179986 planepath=HeptSpiralSkewed,n_start=0 line_type=Y_neg
998 # OEIS-Catalogue: A195023 planepath=HeptSpiralSkewed,n_start=0 line_type=Diagonal
999 # OEIS-Catalogue: A022264 planepath=HeptSpiralSkewed,n_start=0 line_type=Diagonal_NW
1000 # OEIS-Catalogue: A186029 planepath=HeptSpiralSkewed,n_start=0 line_type=Diagonal_SW
1001 # OEIS-Catalogue: A024966 planepath=HeptSpiralSkewed,n_start=0 line_type=Diagonal_SE
1002 },
1003 };
1004 }
1005 { package Math::PlanePath::OctagramSpiral;
1006 use constant _NumSeq_X_axis_increasing => 1;
1007 use constant _NumSeq_Y_axis_increasing => 1;
1008 use constant _NumSeq_X_neg_increasing => 1;
1009 use constant _NumSeq_Y_neg_increasing => 1;
1010 use constant _NumSeq_Diagonal_increasing => 1;
1011 use constant _NumSeq_Diagonal_NW_increasing => 1;
1012 use constant _NumSeq_Diagonal_SW_increasing => 1;
1013 use constant _NumSeq_Diagonal_SE_increasing => 1;
1014  
1015 use constant _NumSeq_N_oeis_anum =>
1016 {
1017 'n_start=1' =>
1018 { Diagonal_SE => 'A194268',
1019 # OEIS-Other: A194268 planepath=OctagramSpiral line_type=Diagonal_SE
1020  
1021 # Not quite, but A125201 doesn't have initial N=1 for path origin
1022 # X_axis => 'A125201'
1023 },
1024  
1025 'n_start=0' =>
1026 { X_axis => 'A051870', # 18-gonals
1027 Y_axis => 'A139273',
1028 X_neg => 'A139275',
1029 Y_neg => 'A139277',
1030 Diagonal => 'A139272',
1031 Diagonal_NW => 'A139274',
1032 Diagonal_SW => 'A139276',
1033 Diagonal_SE => 'A139278', # second 18-gonals
1034 # OEIS-Other: A051870 planepath=OctagramSpiral,n_start=0
1035 # OEIS-Catalogue: A139273 planepath=OctagramSpiral,n_start=0 line_type=Y_axis
1036 # OEIS-Catalogue: A139275 planepath=OctagramSpiral,n_start=0 line_type=X_neg
1037 # OEIS-Catalogue: A139277 planepath=OctagramSpiral,n_start=0 line_type=Y_neg
1038 # OEIS-Catalogue: A139272 planepath=OctagramSpiral,n_start=0 line_type=Diagonal
1039 # OEIS-Catalogue: A139274 planepath=OctagramSpiral,n_start=0 line_type=Diagonal_NW
1040 # OEIS-Catalogue: A139276 planepath=OctagramSpiral,n_start=0 line_type=Diagonal_SW
1041 # OEIS-Other: A139278 planepath=OctagramSpiral,n_start=0 line_type=Diagonal_SE
1042 },
1043 };
1044 }
1045 { package Math::PlanePath::AnvilSpiral;
1046 use constant _NumSeq_X_axis_increasing => 1;
1047 use constant _NumSeq_Y_axis_increasing => 1;
1048 *_NumSeq_X_neg_increasing
1049 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_increasing;
1050 *_NumSeq_X_neg_increasing_from_i
1051 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_increasing_from_i;
1052 *_NumSeq_X_neg_min
1053 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_min;
1054 use constant _NumSeq_Y_neg_increasing => 1;
1055 use constant _NumSeq_Diagonal_increasing => 1;
1056 use constant _NumSeq_Diagonal_NW_increasing => 1;
1057 use constant _NumSeq_Diagonal_SW_increasing => 1;
1058 use constant _NumSeq_Diagonal_SE_increasing => 1;
1059  
1060 use constant _NumSeq_N_oeis_anum =>
1061 { 'wider=0,n_start=1' =>
1062 { X_axis => 'A033570', # odd pentagonals (2n+1)*(3n+1)
1063 Diagonal => 'A033568', # odd second pentagonals
1064 Diagonal_SE => 'A085473',
1065 # OEIS-Catalogue: A033570 planepath=AnvilSpiral
1066 # OEIS-Catalogue: A033568 planepath=AnvilSpiral line_type=Diagonal
1067 # OEIS-Catalogue: A085473 planepath=AnvilSpiral line_type=Diagonal_SE
1068  
1069 # Not quite, A136392 OFFSET=1 value=1 whereas path start Y=0 value=1
1070 # Y_neg => 'A136392', # 1,9,29,61, 6n^2-10n+5
1071 },
1072 'wider=0,n_start=1,i_start=1' =>
1073 { Y_axis => 'A126587', # points within 3,4,5 triangle, starting value=3
1074 # OEIS-Catalogue: A126587 planepath=AnvilSpiral line_type=Y_axis i_start=1
1075 },
1076  
1077 'wider=0,n_start=0' =>
1078 { X_axis => 'A211014', # 14-gonal second
1079 Y_axis => 'A139267', # 2*octagonal
1080 X_neg => 'A049452', # alternate pentagonals
1081 Y_neg => 'A033580', # 4*second pentagonals
1082 Diagonal => 'A051866', # 14-gonals
1083 Diagonal_NW => 'A094159', # 3*hexagonal
1084 Diagonal_SW => 'A049453',
1085 Diagonal_SE => 'A195319', # 3*second hexagonal
1086 # OEIS-Other: A211014 planepath=AnvilSpiral,n_start=0
1087 # OEIS-Other: A051866 planepath=AnvilSpiral,n_start=0 line_type=Diagonal
1088 # OEIS-Catalogue: A139267 planepath=AnvilSpiral,n_start=0 line_type=Y_axis
1089 # OEIS-Catalogue: A049452 planepath=AnvilSpiral,n_start=0 line_type=X_neg
1090 # OEIS-Catalogue: A033580 planepath=AnvilSpiral,n_start=0 line_type=Y_neg
1091 # OEIS-Catalogue: A094159 planepath=AnvilSpiral,n_start=0 line_type=Diagonal_NW
1092 # OEIS-Catalogue: A049453 planepath=AnvilSpiral,n_start=0 line_type=Diagonal_SW
1093 # OEIS-Catalogue: A195319 planepath=AnvilSpiral,n_start=0 line_type=Diagonal_SE
1094 },
1095  
1096 # Not quite, A051866 starts value=0 which is at X=-1
1097 # 'wider=1,n_start=0' =>
1098 # { X_axis => 'A051866',
1099 # # OEIS-Other: A051866 planepath=AnvilSpiral,wider=1,n_start=0
1100 # },
1101 # 'wider=1,n_start=0' =>
1102 # { Diagonal_NW_minus_1 => 'A033569', # (2*n-1)*(3*n+1) starting -1
1103 # # XX-Other: A033569 planepath=AnvilSpiral,wider=1,n_start=-1 line_type=Diagonal_NW
1104 # },
1105  
1106 # 'wider=2,n_start=1' =>
1107 # {
1108 # Not quite, A033581 initial value=2 whereas path start N=0
1109 # # Y_axis => 'A033581', # 6*n^2 is 14-gonals pairs average in Math::NumSeq::Polygonal
1110 # # # OEIS-Other: A033581 planepath=AnvilSpiral,wider=2 line_type=Y_axis
1111 # },
1112 };
1113 }
1114 { package Math::PlanePath::KnightSpiral;
1115 use constant _NumSeq_Diagonal_increasing => 1; # low then high
1116 use constant _NumSeq_Diagonal_NW_increasing => 1;
1117 use constant _NumSeq_Diagonal_SW_increasing => 1;
1118 use constant _NumSeq_Diagonal_SE_increasing => 1;
1119 }
1120 { package Math::PlanePath::CretanLabyrinth;
1121 use constant _NumSeq_X_axis_increasing => 1;
1122 }
1123 { package Math::PlanePath::SquareArms;
1124 use constant _NumSeq_X_axis_increasing => 1;
1125 use constant _NumSeq_Y_axis_increasing => 1;
1126 use constant _NumSeq_X_neg_increasing => 1;
1127 use constant _NumSeq_Y_neg_increasing => 1;
1128 use constant _NumSeq_Diagonal_increasing => 1;
1129 use constant _NumSeq_Diagonal_NW_increasing => 1;
1130 use constant _NumSeq_Diagonal_SW_increasing => 1;
1131 use constant _NumSeq_Diagonal_SE_increasing => 1;
1132 }
1133 { package Math::PlanePath::SacksSpiral;
1134 use constant _NumSeq_X_axis_increasing => 1;
1135 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1136 use constant _NumSeq_X_neg_increasing => 1;
1137 use constant _NumSeq_Y_neg_increasing => 1;
1138 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1139 use constant _NumSeq_Diagonal_NW_increasing => 1;
1140 use constant _NumSeq_Diagonal_SW_increasing => 1;
1141 use constant _NumSeq_Diagonal_SE_increasing => 1;
1142  
1143 # SacksSpiral X_axis -- squares (i-1)^2, starting from i=1 value=0
1144 }
1145 { package Math::PlanePath::VogelFloret;
1146 use constant _NumSeq_X_axis_increasing => 1; # when touched
1147 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1148 use constant _NumSeq_X_neg_increasing => 1;
1149 use constant _NumSeq_Y_neg_increasing => 1;
1150 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1151 use constant _NumSeq_Diagonal_NW_increasing => 1;
1152 use constant _NumSeq_Diagonal_SW_increasing => 1;
1153 use constant _NumSeq_Diagonal_SE_increasing => 1;
1154 }
1155 { package Math::PlanePath::TheodorusSpiral;
1156 use constant _NumSeq_X_axis_increasing => 1; # when touched
1157 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1158 use constant _NumSeq_X_neg_increasing => 1;
1159 use constant _NumSeq_Y_neg_increasing => 1;
1160 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1161 use constant _NumSeq_Diagonal_NW_increasing => 1;
1162 use constant _NumSeq_Diagonal_SW_increasing => 1;
1163 use constant _NumSeq_Diagonal_SE_increasing => 1;
1164 }
1165 { package Math::PlanePath::ArchimedeanChords;
1166 use constant _NumSeq_X_axis_increasing => 1; # when touched
1167 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1168 use constant _NumSeq_X_neg_increasing => 1;
1169 use constant _NumSeq_Y_neg_increasing => 1;
1170 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1171 use constant _NumSeq_Diagonal_NW_increasing => 1;
1172 use constant _NumSeq_Diagonal_SW_increasing => 1;
1173 use constant _NumSeq_Diagonal_SE_increasing => 1;
1174 }
1175 { package Math::PlanePath::MultipleRings;
1176 use constant _NumSeq_X_axis_increasing => 1;
1177 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1178 use constant _NumSeq_X_neg_increasing => 1;
1179 use constant _NumSeq_Y_neg_increasing => 1;
1180 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1181 use constant _NumSeq_Diagonal_NW_increasing => 1;
1182 use constant _NumSeq_Diagonal_SW_increasing => 1;
1183 use constant _NumSeq_Diagonal_SE_increasing => 1;
1184 }
1185 { package Math::PlanePath::PixelRings;
1186 use constant _NumSeq_X_axis_increasing => 1;
1187 use constant _NumSeq_Y_axis_increasing => 1;
1188 use constant _NumSeq_X_neg_increasing => 1;
1189 use constant _NumSeq_Y_neg_increasing => 1;
1190 use constant _NumSeq_Diagonal_increasing => 1; # where covered
1191 use constant _NumSeq_Diagonal_NW_increasing => 1;
1192 use constant _NumSeq_Diagonal_SW_increasing => 1;
1193 use constant _NumSeq_Diagonal_SE_increasing => 1;
1194 }
1195 { package Math::PlanePath::FilledRings;
1196 use constant _NumSeq_X_axis_increasing => 1;
1197 use constant _NumSeq_Y_axis_increasing => 1;
1198 use constant _NumSeq_X_neg_increasing => 1;
1199 use constant _NumSeq_Y_neg_increasing => 1;
1200 use constant _NumSeq_Diagonal_increasing => 1;
1201 use constant _NumSeq_Diagonal_NW_increasing => 1;
1202 use constant _NumSeq_Diagonal_SW_increasing => 1;
1203 use constant _NumSeq_Diagonal_SE_increasing => 1;
1204  
1205 # use constant _NumSeq_N_oeis_anum =>
1206 # {
1207 # # Not quite, A036704 OFFSET=0 value=1,9,21 vs X=0 value=0,1,9,21
1208 # 'n_start=0' =>
1209 # { X_axis => 'A036704', # count points norm <= n+1/2
1210 # },
1211 # };
1212 }
1213 { package Math::PlanePath::Hypot;
1214 sub _NumSeq_X_axis_i_start {
1215 my ($self) = @_;
1216 ### _NumSeq_X_axis_i_start() ...
1217 return ($self->{'points'} eq 'odd'
1218 ? 1 # X=0,Y=0 not visited
1219 : 0);
1220 }
1221 sub _NumSeq_X_neg_i_start {
1222 my ($self) = @_;
1223 ### _NumSeq_X_axis_i_start() ...
1224 return ($self->{'points'} eq 'odd'
1225 ? -1 # X=0,Y=0 not visited
1226 : 0);
1227 }
1228 *_NumSeq_Y_axis_i_start = \&_NumSeq_X_axis_i_start;
1229 *_NumSeq_Y_neg_i_start = \&_NumSeq_X_neg_i_start;
1230  
1231 use constant _NumSeq_X_axis_increasing => 1;
1232 use constant _NumSeq_Y_axis_increasing => 1;
1233 use constant _NumSeq_X_neg_increasing => 1;
1234 use constant _NumSeq_Y_neg_increasing => 1;
1235 use constant _NumSeq_Diagonal_increasing => 1;
1236 use constant _NumSeq_Diagonal_NW_increasing => 1;
1237 use constant _NumSeq_Diagonal_SW_increasing => 1;
1238 use constant _NumSeq_Diagonal_SE_increasing => 1;
1239  
1240 use constant _NumSeq_N_oeis_anum =>
1241 { 'points=all,n_start=0' =>
1242 { X_axis => 'A051132', # count points < n^2
1243 # OEIS-Catalogue: A051132 planepath=Hypot,n_start=0
1244 },
1245 };
1246 }
1247 { package Math::PlanePath::HypotOctant;
1248 use constant _NumSeq_X_axis_increasing => 1;
1249 use constant _NumSeq_Y_axis_increasing => 1;
1250 use constant _NumSeq_Diagonal_increasing => 1;
1251 *_NumSeq_X_axis_i_start = \&Math::PlanePath::Hypot::_NumSeq_X_axis_i_start;
1252  
1253 use constant _NumSeq_N_oeis_anum =>
1254 { 'points=even' =>
1255 { Diagonal => 'A036702', # count points |z|<=n for 0<=b<=a
1256 # OEIS-Catalogue: A036702 planepath=HypotOctant,points=even line_type=Diagonal
1257 },
1258 };
1259 }
1260 { package Math::PlanePath::TriangularHypot;
1261 sub _NumSeq_X_axis_i_start {
1262 my ($self) = @_;
1263 return ($self->{'points'} eq 'odd' || $self->{'points'} eq 'hex_centred'
1264 ? 1 # X=0,Y=0 not visited
1265 : 0);
1266 }
1267 *_NumSeq_Diagonal_i_start = \&_NumSeq_X_axis_i_start;
1268 *_NumSeq_Diagonal_SE_i_start = \&_NumSeq_X_axis_i_start;
1269 sub _NumSeq_X_neg_i_start {
1270 my ($self) = @_;
1271 return - $self->_NumSeq_X_axis_i_start;
1272 }
1273 *_NumSeq_Diagonal_NW_i_start = \&_NumSeq_X_axis_i_start;
1274 *_NumSeq_Diagonal_SW_i_start = \&_NumSeq_X_axis_i_start;
1275 use constant _NumSeq_X_axis_increasing => 1;
1276 use constant _NumSeq_Y_axis_increasing => 1;
1277 use constant _NumSeq_X_neg_increasing => 1;
1278 use constant _NumSeq_Y_neg_increasing => 1;
1279 use constant _NumSeq_Diagonal_increasing => 1;
1280 use constant _NumSeq_Diagonal_NW_increasing => 1;
1281 use constant _NumSeq_Diagonal_SW_increasing => 1;
1282 use constant _NumSeq_Diagonal_SE_increasing => 1;
1283 }
1284 { package Math::PlanePath::PythagoreanTree;
1285 use constant _NumSeq_X_axis_increasing => 1;
1286  
1287 use constant _NumSeq_N_oeis_all_anum =>
1288 { Depth_start => 'A007051', # (3^n+1)/2
1289 # OEIS-Catalogue: A007051 planepath=PythagoreanTree line_type=Depth_start
1290  
1291 # Not quite, Depth_end=(3^(n+1)-1)/2, so is n+1
1292 # Depth_end => 'A003462', # (3^n-1)/2
1293 };
1294 }
1295 { package Math::PlanePath::RationalsTree;
1296 use constant _NumSeq_X_axis_increasing => 1;
1297  
1298 sub _NumSeq_Y_axis_increasing {
1299 my ($self) = @_;
1300 return ($self->{'tree_type'} eq 'L' ? 0 : 1);
1301 }
1302 sub _NumSeq_Y_axis_increasing_from_i {
1303 my ($self) = @_;
1304 return ($self->{'tree_type'} eq 'L' ? 2 : 1);
1305 }
1306 use constant _NumSeq_Y_axis_min => 1;
1307 use constant _NumSeq_Diagonal_increasing => 1;
1308  
1309 use constant _NumSeq_N_oeis_anum =>
1310 { 'tree_type=SB' =>
1311 { Depth_start => 'A000079', # powers-of-2
1312 # RationalsTree SB -- X_axis 2^n-1 but starting X=1
1313 # RationalsTree SB,CW -- Y_axis A000079 2^n but starting Y=1
1314 },
1315  
1316 'tree_type=CW' =>
1317 { Depth_start => 'A000079', # powers-of-2
1318 },
1319  
1320 'tree_type=Bird' =>
1321 { X_axis => 'A081254', # local max sumdisttopow2(m)/m^2
1322 Depth_start => 'A000079', # powers-of-2
1323 # OEIS-Catalogue: A081254 planepath=RationalsTree,tree_type=Bird
1324 # OEIS-Other: A000079 planepath=RationalsTree,tree_type=Bird line_type=Depth_start
1325  
1326 # RationalsTree Bird -- Y_axis almost A000975 10101 101010 no
1327 # consecutive equal bits, but start=1
1328 },
1329  
1330 'tree_type=Drib' =>
1331 { X_axis => 'A086893', # pos of fibonacci F(n+1)/F(n) in Stern diatomic
1332 Depth_start => 'A000079', # powers-of-2
1333 # OEIS-Catalogue: A086893 planepath=RationalsTree,tree_type=Drib
1334  
1335 # Drib Y_axis
1336 # Not quite, A061547 OFFSET=1 value=0 cf path Y=1 value N=1
1337 # Y_axis => 'A061547'# derangements or alternating bits plus pow4
1338 },
1339  
1340 'tree_type=AYT' =>
1341 { Depth_start => 'A000079', # powers-of-2
1342 # RationalsTree AYT -- Y_axis A083318 2^n+1 but starting Y=1
1343 },
1344  
1345 'tree_type=HCS' =>
1346 { Depth_start => 'A000079', # powers-of-2
1347  
1348 # RationalsTree HCS
1349 # Not quite, A000079 OFFSET=0 value=1 cf here X=1 N=1
1350 # X_axis => 'A000079', # powers 2^X
1351 # Not quite, A007283 OFFSET=0 and doesn't have extra N=1 at Y=1
1352 # Y_axis => 'A007283', # 3*2^n starting OFFSET=0 value=3
1353 },
1354 };
1355 }
1356 { package Math::PlanePath::FractionsTree;
1357 use constant _NumSeq_Diagonal_increasing => 1;
1358 use constant _NumSeq_Diagonal_X_offset => -1;
1359  
1360 use constant _NumSeq_Y_axis_increasing => 1;
1361 use constant _NumSeq_Y_axis_i_start => 2;
1362 }
1363 { package Math::PlanePath::ChanTree;
1364 use constant _NumSeq_X_axis_increasing => 1;
1365 use constant _NumSeq_X_axis_i_start => 1;
1366  
1367 use constant _NumSeq_Y_axis_i_start => 1; # start at Y=1
1368 use constant _NumSeq_Y_axis_increasing => 1;
1369  
1370 use constant _NumSeq_Diagonal_increasing => 1;
1371  
1372 use constant _NumSeq_N_oeis_anum =>
1373 { 'k=2,n_start=1' =>
1374 { Depth_start => 'A000079', # powers-of-2
1375 # OEIS-Other: A000079 planepath=ChanTree,n_start=1,k=2 line_type=Depth_start
1376  
1377 # Depth_end is 2^k-1 A000225, or 2^k-2 A000918, but without initial
1378 # 0 or -1.
1379 },
1380 'k=2,n_start=0' =>
1381 { Depth_start => 'A000225', # 2^k-1
1382 # OEIS-Other: A000225 planepath=ChanTree,k=2 line_type=Depth_start
1383 },
1384  
1385 'k=3,n_start=1' =>
1386 { Depth_start => 'A000244', # powers-of-3
1387 # OEIS-Other: A000244 planepath=ChanTree,n_start=1 line_type=Depth_start
1388 },
1389 'k=4,n_start=1' =>
1390 { Depth_start => 'A000302', # powers-of-4
1391 # OEIS-Other: A000302 planepath=ChanTree,n_start=1,k=4 line_type=Depth_start
1392 },
1393 'k=5,n_start=1' =>
1394 { Depth_start => 'A000351', # powers-of-5
1395 # OEIS-Other: A000351 planepath=ChanTree,n_start=1,k=5 line_type=Depth_start
1396 },
1397 'k=10,n_start=1' =>
1398 { Depth_start => 'A011557', # powers-of-10
1399 # OEIS-Other: A011557 planepath=ChanTree,n_start=1,k=10 line_type=Depth_start
1400 },
1401 };
1402 }
1403 { package Math::PlanePath::DiagonalRationals;
1404 use constant _NumSeq_X_axis_increasing => 1;
1405 use constant _NumSeq_Y_axis_increasing => 1;
1406 use constant _NumSeq_X_axis_i_start => 1;
1407 use constant _NumSeq_Y_axis_i_start => 1;
1408  
1409 # Diagonal => 'A002088', # cumulative totient
1410 # Not quite, start X=1 value=1 cf seq OFFSET=0 value=0
1411 }
1412 { package Math::PlanePath::FactorRationals;
1413 use constant _NumSeq_X_axis_i_start => 1;
1414 sub _NumSeq_X_axis_increasing {
1415 my ($self) = @_;
1416 # perfect squares along X axis of even/odd
1417 return $self->{'factor_coding'} eq 'even/odd';
1418 }
1419  
1420 use constant _NumSeq_Y_axis_i_start => 1;
1421 sub _NumSeq_Y_axis_increasing {
1422 my ($self) = @_;
1423 # perfect squares along Y axis of odd/even
1424 return $self->{'factor_coding'} eq 'odd/even';
1425 }
1426  
1427 use constant _NumSeq_N_oeis_anum =>
1428 { 'factor_coding=even/odd' =>
1429 { Y_axis => 'A102631', # n^2/(squarefree kernel)
1430 # OEIS-Catalogue: A102631 planepath=FactorRationals line_type=Y_axis
1431  
1432 # # Not quite, OFFSET=0 value 0 whereas start X=Y=1 value 1 here
1433 # X_axis => 'A000290', # squares 0,1,4,9
1434 # # OEIS-Other: A000290 planepath=FactorRationals
1435 },
1436 'factor_coding=odd/even' =>
1437 { X_axis => 'A102631', # n^2/(squarefree kernel)
1438 # OEIS-Other: A102631 planepath=FactorRationals,factor_coding=odd/even
1439 },
1440 };
1441 }
1442 { package Math::PlanePath::GcdRationals;
1443 use constant _NumSeq_X_axis_increasing => 1;
1444 use constant _NumSeq_Y_axis_increasing => 1;
1445 use constant _NumSeq_X_axis_i_start => 1;
1446 use constant _NumSeq_Y_axis_i_start => 1;
1447  
1448 # GcdRationals
1449 # Not quite, starts X=1
1450 # X_axis => triangular row
1451 # Not quite, starts X=1 here cf OFFSET=0 in A000124
1452 # Y_axis => 'A000124', # triangular+1
1453 #
1454 # GcdRationals,pairs_order=diagonals_down
1455 # Not quite, start X=1 here cf A000290 starts OFFSET=1
1456 # X_axis => 'A000290', # Y=1 row, perfect squares
1457 # Not quite, A033638 starts two ones 1,1,...
1458 # Y_axis => 'A033638', # quarter-squares + 1
1459 #
1460 # GcdRationals,pairs_order=diagonals_up
1461 # Not quite, A002061 starts two ones 1,1,
1462 # X_axis => 'A002061',
1463 # Not quite, X=1 column squares+pronic, but no initial 0,0 of A002620
1464 # Y_axis => 'A002620', # X=1 column
1465 # Not quite, starting value=2 here
1466 # Diagonal_above => 'A002522', # Y=X+1 diagonal, squares+1
1467 }
1468 { package Math::PlanePath::CfracDigits;
1469 # 1
1470 # diagonal Y/(Y+1) = 0 + -----
1471 # 1 + 1/Y
1472 # q0=1 q1=Y
1473 # N = 3,Y-1 in 1,2,3
1474 # = 1,0,Y-1 in 0,1,2
1475 #
1476 use constant _NumSeq_Diagonal_increasing => 1;
1477 use constant _NumSeq_Diagonal_X_offset => -1;
1478 use constant _NumSeq_Y_axis_increasing => 1; # radix without digit 0
1479 }
1480 { package Math::PlanePath::PeanoCurve;
1481 sub _NumSeq_X_axis_increasing {
1482 my ($self) = @_;
1483 return ($self->{'radix'} % 2);
1484 }
1485 *_NumSeq_Y_axis_increasing = \&_NumSeq_X_axis_increasing;
1486  
1487 use constant _NumSeq_N_oeis_anum =>
1488 { 'radix=3' =>
1489 { X_axis => 'A163480', # axis same as initial direction
1490 Y_axis => 'A163481', # axis opp to initial direction
1491 Diagonal => 'A163343',
1492 },
1493 # OEIS-Catalogue: A163480 planepath=PeanoCurve
1494 # OEIS-Catalogue: A163481 planepath=PeanoCurve line_type=Y_axis
1495 # OEIS-Catalogue: A163343 planepath=PeanoCurve line_type=Diagonal
1496  
1497 # OEIS-Other: A163480 planepath=GrayCode,apply_type=TsF,radix=3
1498 # OEIS-Other: A163481 planepath=GrayCode,apply_type=TsF,radix=3 line_type=Y_axis
1499 # OEIS-Other: A163343 planepath=GrayCode,apply_type=TsF,radix=3 line_type=Diagonal
1500  
1501 # OEIS-Other: A163480 planepath=GrayCode,apply_type=FsT,radix=3
1502 # OEIS-Other: A163481 planepath=GrayCode,apply_type=FsT,radix=3 line_type=Y_axis
1503 # OEIS-Other: A163343 planepath=GrayCode,apply_type=FsT,radix=3 line_type=Diagonal
1504 };
1505 }
1506 { package Math::PlanePath::WunderlichSerpentine;
1507 sub _NumSeq_X_axis_increasing {
1508 my ($self) = @_;
1509 if ($self->{'radix'} % 2) {
1510 return 1; # odd radix always increasing
1511 }
1512 # FIXME: depends on the serpentine_type bits
1513 return 0;
1514 }
1515 sub _NumSeq_Y_axis_increasing {
1516 my ($self) = @_;
1517 if ($self->{'radix'} % 2) {
1518 return 1; # odd radix always increasing
1519 }
1520 # FIXME: depends on the serpentine_type bits
1521 return 0;
1522 }
1523 }
1524 { package Math::PlanePath::HilbertCurve;
1525 use constant _NumSeq_X_axis_increasing => 1;
1526 use constant _NumSeq_Y_axis_increasing => 1;
1527 use constant _NumSeq_Diagonal_increasing => 1;
1528  
1529 use constant _NumSeq_N_oeis_anum =>
1530 { '' =>
1531 { X_axis => 'A163482',
1532 Y_axis => 'A163483',
1533 Diagonal => 'A062880', # base 4 digits 0,2 only
1534 # OEIS-Catalogue: A163482 planepath=HilbertCurve
1535 # OEIS-Catalogue: A163483 planepath=HilbertCurve line_type=Y_axis
1536 # OEIS-Other: A062880 planepath=HilbertCurve line_type=Diagonal
1537 },
1538 };
1539 }
1540 { package Math::PlanePath::HilbertSides;
1541 use constant _NumSeq_X_axis_increasing => 1;
1542 use constant _NumSeq_Y_axis_increasing => 1;
1543 use constant _NumSeq_Diagonal_increasing => 1;
1544  
1545 use constant _NumSeq_N_oeis_anum =>
1546 { '' =>
1547 { Diagonal => 'A062880', # base 4 digits 0,2 only
1548 # OEIS-Other: A062880 planepath=HilbertSides line_type=Diagonal
1549 },
1550 };
1551 }
1552 { package Math::PlanePath::HilbertSpiral;
1553 use constant _NumSeq_Diagonal_increasing => 1;
1554 use constant _NumSeq_Diagonal_SW_increasing => 1;
1555 }
1556 { package Math::PlanePath::ZOrderCurve;
1557 use constant _NumSeq_X_axis_increasing => 1;
1558 use constant _NumSeq_Y_axis_increasing => 1;
1559 use constant _NumSeq_Diagonal_increasing => 1;
1560  
1561 use constant _NumSeq_N_oeis_anum =>
1562 { 'radix=2' =>
1563 { X_axis => 'A000695', # base 4 digits 0,1 only (RadixConversion)
1564 Y_axis => 'A062880', # base 4 digits 0,2 only
1565 Diagonal => 'A001196', # base 4 digits 0,3 only
1566 # OEIS-Other: A000695 planepath=ZOrderCurve
1567 # OEIS-Catalogue: A062880 planepath=ZOrderCurve line_type=Y_axis
1568 # OEIS-Catalogue: A001196 planepath=ZOrderCurve line_type=Diagonal
1569 },
1570 'radix=3,i_start=1' =>
1571 { X_axis => 'A037314', # base 9 digits 0,1,2 only, starting OFFSET=1 value=1
1572 Y_axis => 'A208665', # base 9 digits 0,3,6 only, starting OFFSET=1 value=3
1573 # OEIS-Catalogue: A037314 planepath=ZOrderCurve,radix=3 i_start=1
1574 # OEIS-Catalogue: A208665 planepath=ZOrderCurve,radix=3 i_start=1 line_type=Y_axis
1575  
1576 # ZOrderCurve dir=2 radix,3: match 6,27,30,33,54,57,60,243,246,249,270,273,276,297,300
1577 # A208665 Numbers that match odd ternary polynomials; see Comments.
1578 # A208665 ,3,6,27,30,33,54,57,60,243,246,249,270,273,276,297,300,303,486,489,492,513,516,519,540,543,546,2187,2190,2193,2214,2217,2220,2241,2244,2247,2430,2433,2436,2457,2460,2463,2484,2487,2490,2673,2676,2679,
1579 # base 9 digits 0,3,6 only
1580 },
1581 'radix=10' =>
1582 { X_axis => 'A051022', # base 10 insert 0s, for digits 0 to 9 base 100
1583 # OEIS-Catalogue: A051022 planepath=ZOrderCurve,radix=10
1584 },
1585 };
1586 }
1587 { package Math::PlanePath::GrayCode;
1588  
1589 # X axis increasing for:
1590 # radix=2 TsF,Fs
1591 # radix=3 reflected TsF,FsT
1592 # radix=3 modular TsF,Fs
1593 # radix=4 reflected TsF,Fs
1594 # radix=4 modular TsF,Fs
1595 # radix=5 reflected TsF,FsT
1596 # radix=5 modular TsF,Fs
1597 #
1598 sub _NumSeq_X_axis_increasing {
1599 my ($self) = @_;
1600 if ($self->{'gray_type'} eq 'modular' || $self->{'radix'} == 2) {
1601 return ($self->{'apply_type'} eq 'TsF'
1602 || $self->{'apply_type'} eq 'Fs');
1603 }
1604 if ($self->{'radix'} & 1) {
1605 return ($self->{'apply_type'} eq 'TsF'
1606 || $self->{'apply_type'} eq 'FsT');
1607 } else {
1608 return ($self->{'apply_type'} eq 'TsF'
1609 || $self->{'apply_type'} eq 'Fs');
1610 }
1611 }
1612 *_NumSeq_Y_axis_increasing = \&_NumSeq_X_axis_increasing;
1613  
1614 # Diagonal increasing for:
1615 # radix=2 FsT,Ts
1616 # radix=3 reflected Ts,Fs
1617 # radix=3 modular FsT
1618 # radix=4 reflected FsT,Ts
1619 # radix=4 modular FsT
1620 # radix=5 reflected Ts,Fs
1621 # radix=5 modular FsT
1622 sub _NumSeq_Diagonal_increasing {
1623 my ($self) = @_;
1624 if ($self->{'radix'} & 1) {
1625 if ($self->{'gray_type'} eq 'modular') {
1626 return ($self->{'apply_type'} eq 'FsT'); # odd modular
1627 } else {
1628 return ($self->{'apply_type'} eq 'Ts'
1629 || $self->{'apply_type'} eq 'Fs'); # odd reflected
1630 }
1631 }
1632 if ($self->{'gray_type'} eq 'reflected' || $self->{'radix'} == 2) {
1633 return ($self->{'apply_type'} eq 'FsT'
1634 || $self->{'apply_type'} eq 'Ts'); # even reflected
1635 } else {
1636 return ($self->{'apply_type'} eq 'FsT'); # even modular
1637 }
1638 }
1639  
1640 use constant _NumSeq_N_oeis_anum =>
1641 {
1642 'apply_type=TsF,gray_type=reflected,radix=3' =>
1643 (Math::PlanePath::PeanoCurve->_NumSeq_N_oeis_anum->{'radix=3'}
1644 || die "Oops, SquareSpiral NumSeq PlanePathN not found"),
1645 'apply_type=FsT,gray_type=reflected,radix=3' =>
1646 (Math::PlanePath::PeanoCurve->_NumSeq_N_oeis_anum->{'radix=3'}
1647 || die "Oops, SquareSpiral NumSeq PlanePathN not found"),
1648  
1649 # GrayCode radix=2 TsF==Fs reflected==modular
1650 do {
1651 my $href =
1652 { Y_axis => 'A001196', # base 4 digits 0,3 only
1653 };
1654 ('apply_type=TsF,gray_type=reflected,radix=2' => $href,
1655 'apply_type=Fs,gray_type=reflected,radix=2' => $href,
1656 'apply_type=TsF,gray_type=modular,radix=2' => $href,
1657 'apply_type=Fs,gray_type=modular,radix=2' => $href,
1658 );
1659 # OEIS-Other: A001196 planepath=GrayCode,apply_type=TsF line_type=Y_axis
1660 # OEIS-Other: A001196 planepath=GrayCode,apply_type=Fs line_type=Y_axis
1661 # OEIS-Other: A001196 planepath=GrayCode,apply_type=TsF,gray_type=modular line_type=Y_axis
1662 # OEIS-Other: A001196 planepath=GrayCode,apply_type=Fs,gray_type=modular line_type=Y_axis
1663 },
1664 # GrayCode radix=2 Ts==FsT reflected==modular
1665 do {
1666 my $href =
1667 { Diagonal => 'A062880', # base 4 digits 0,2 only
1668 };
1669 ('apply_type=Ts,gray_type=reflected,radix=2' => $href,
1670 'apply_type=Ts,gray_type=modular,radix=2' => $href,
1671 'apply_type=FsT,gray_type=reflected,radix=2' => $href,
1672 'apply_type=FsT,gray_type=modular,radix=2' => $href,
1673 );
1674 # OEIS-Other: A062880 planepath=GrayCode,apply_type=Ts line_type=Diagonal
1675 # OEIS-Other: A062880 planepath=GrayCode,apply_type=Ts,gray_type=modular line_type=Diagonal
1676 # OEIS-Other: A062880 planepath=GrayCode,apply_type=FsT line_type=Diagonal
1677 # OEIS-Other: A062880 planepath=GrayCode,apply_type=FsT,gray_type=modular line_type=Diagonal
1678 },
1679  
1680 # GrayCode radix=3 sT==sF reflected
1681 # N split then toGray giving Y=0 means N ternary 010202 etc
1682 # N split then toGray giving X=Y means N ternary pairs 112200
1683 do {
1684 my $href =
1685 { X_axis => 'A163344', # central Peano/4, base9 digits 0,1,2 only
1686 Diagonal => 'A163343', # central diagonal of Peano, base9 0,4,8
1687 };
1688 ('apply_type=sT,gray_type=reflected,radix=3' => $href,
1689 'apply_type=sF,gray_type=reflected,radix=3' => $href,
1690 );
1691 # OEIS-Catalogue: A163344 planepath=GrayCode,apply_type=sT,radix=3
1692 # OEIS-Other: A163344 planepath=GrayCode,apply_type=sF,radix=3
1693  
1694 # OEIS-Other: A163343 planepath=GrayCode,apply_type=sT,radix=3 line_type=Diagonal
1695 # OEIS-Other: A163343 planepath=GrayCode,apply_type=sF,radix=3 line_type=Diagonal
1696 },
1697  
1698 'apply_type=FsT,gray_type=modular,radix=3,i_start=1' =>
1699 { Diagonal => 'A208665', # base 9 digits 0,3,6
1700 # OEIS-Other: A208665 planepath=GrayCode,apply_type=FsT,gray_type=modular,radix=3 line_type=Diagonal i_start=1
1701 },
1702 };
1703 }
1704 # { package Math::PlanePath::ImaginaryBase;
1705 # }
1706 { package Math::PlanePath::ImaginaryHalf;
1707 use constant _NumSeq_Y_axis_increasing => 1;
1708  
1709 use constant _NumSeq_N_oeis_anum =>
1710 { 'radix=2,digit_order=YXX' =>
1711 { Y_axis => 'A033045', # base 8 digits 0,1 only
1712 # OEIS-Other: A033045 planepath=ImaginaryHalf,digit_order=YXX line_type=Y_axis
1713 },
1714 'radix=2,digit_order=YXnX' =>
1715 { Y_axis => 'A033045', # base 8 digits 0,1 only
1716 # OEIS-Other: A033045 planepath=ImaginaryHalf,digit_order=YXnX line_type=Y_axis
1717 },
1718 };
1719 }
1720 # { package Math::PlanePath::CubicBase;
1721 # }
1722 { package Math::PlanePath::DekkingCurve;
1723 sub _NumSeq_X_axis_increasing {
1724 my ($self) = @_;
1725 # arms=4 has various interleaving
1726 return $self->{'arms'} < 4;
1727 }
1728 sub _NumSeq_X_neg_increasing {
1729 my ($self) = @_;
1730 # arms=3 has various interleaving
1731 return $self->{'arms'} < 3;
1732 }
1733 sub _NumSeq_Y_axis_increasing {
1734 my ($self) = @_;
1735 # arms=2 has various interleaving
1736 return $self->{'arms'} < 2;
1737 }
1738 sub _NumSeq_Y_neg_increasing {
1739 my ($self) = @_;
1740 # arms=4 has various interleaving
1741 return $self->{'arms'} < 4;
1742 }
1743 }
1744 { package Math::PlanePath::DekkingCentres;
1745 use constant _NumSeq_X_axis_increasing => 1;
1746 use constant _NumSeq_Y_axis_increasing => 1;
1747 }
1748 { package Math::PlanePath::CincoCurve;
1749 use constant _NumSeq_X_axis_increasing => 1;
1750 use constant _NumSeq_Y_axis_increasing => 1;
1751 }
1752 { package Math::PlanePath::BetaOmega;
1753 use constant _NumSeq_X_axis_increasing => 1;
1754 use constant _NumSeq_Y_axis_increasing => 1;
1755 use constant _NumSeq_Y_neg_increasing => 1;
1756 }
1757 { package Math::PlanePath::KochelCurve;
1758 use constant _NumSeq_X_axis_increasing => 1;
1759 use constant _NumSeq_Y_axis_increasing => 1;
1760 }
1761 { package Math::PlanePath::AR2W2Curve;
1762 use constant _NumSeq_X_axis_increasing => 1;
1763 use constant _NumSeq_Y_axis_increasing => 1;
1764 use constant _NumSeq_Diagonal_increasing => 1;
1765 }
1766 { package Math::PlanePath::WunderlichMeander;
1767 use constant _NumSeq_X_axis_increasing => 1;
1768 use constant _NumSeq_Y_axis_increasing => 1;
1769 }
1770 # { package Math::PlanePath::Flowsnake;
1771 # }
1772 # { package Math::PlanePath::FlowsnakeCentres;
1773 # # inherit from Flowsnake
1774 # }
1775 # { package Math::PlanePath::GosperIslands;
1776 # }
1777 # { package Math::PlanePath::GosperSide;
1778 # }
1779 { package Math::PlanePath::KochCurve;
1780 use constant _NumSeq_X_axis_increasing => 1; # when touched
1781 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1782 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1783 }
1784 { package Math::PlanePath::KochPeaks;
1785 use constant _NumSeq_X_axis_increasing => 1; # when touched
1786 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1787 use constant _NumSeq_X_neg_increasing => 1; # when touched
1788 # Diagonal never touched
1789 }
1790 { package Math::PlanePath::KochSnowflakes;
1791 use constant _NumSeq_X_axis_increasing => 1; # when touched
1792 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1793 use constant _NumSeq_X_neg_increasing => 1;
1794 use constant _NumSeq_Y_neg_increasing => 1;
1795 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1796 use constant _NumSeq_Diagonal_NW_increasing => 1;
1797 use constant _NumSeq_Diagonal_SW_increasing => 1;
1798 use constant _NumSeq_Diagonal_SE_increasing => 1;
1799 }
1800 { package Math::PlanePath::KochSquareflakes;
1801 use constant _NumSeq_X_axis_increasing => 1; # when touched
1802 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1803 use constant _NumSeq_X_neg_increasing => 1;
1804 use constant _NumSeq_Y_neg_increasing => 1;
1805 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1806 use constant _NumSeq_Diagonal_NW_increasing => 1;
1807 use constant _NumSeq_Diagonal_SW_increasing => 1;
1808 use constant _NumSeq_Diagonal_SE_increasing => 1;
1809 }
1810 { package Math::PlanePath::QuadricCurve;
1811 use constant _NumSeq_X_axis_increasing => 1; # when touched
1812 use constant _NumSeq_Diagonal_increasing => 1; # two values only
1813 }
1814 { package Math::PlanePath::QuadricIslands;
1815 # FIXME: pred() on Diagonal_SW doesn't notice 0.5 square
1816 use constant _NumSeq_X_axis_increasing => 1; # when touched
1817 use constant _NumSeq_Y_axis_increasing => 1;
1818  
1819 use constant _NumSeq_X_neg_increasing => 1;
1820  
1821 use constant _NumSeq_Y_neg_increasing => 0;
1822 use constant _NumSeq_Y_neg_increasing_from_i => 1; # after 3,2,8
1823 use constant _NumSeq_Y_neg_min => 2; # at X=-1,Y=0 rather than X=0,Y=0
1824 use constant _NumSeq_Diagonal_SW_increasing => 0;
1825 use constant _NumSeq_Diagonal_SW_min => 1;
1826 }
1827 { package Math::PlanePath::SierpinskiTriangle;
1828 use constant _NumSeq_X_axis_increasing => 1; # for "diagonal" style
1829 use constant _NumSeq_Y_axis_increasing => 1;
1830 use constant _NumSeq_Diagonal_increasing => 1;
1831 use constant _NumSeq_Diagonal_NW_increasing => 1;
1832  
1833 # low 10111=23 increment to 11000=24
1834 # 10111 ones=4 width=2^4
1835  
1836 # cf A160722 is 3*A006046-2*n, drawing three Sierpinski triangles
1837 # http://www.polprimos.com/imagenespub/polca722.jpg
1838 #
1839 use constant _NumSeq_N_oeis_anum =>
1840 {
1841 #---------
1842 # i_start=0, n_start=0
1843  
1844 'align=triangular,n_start=0' =>
1845 { Diagonal_NW => 'A006046',
1846 Depth_start => 'A006046',
1847 # OEIS-Other: A006046 planepath=SierpinskiTriangle line_type=Diagonal_NW
1848 # OEIS-Other: A006046 planepath=SierpinskiTriangle line_type=Depth_start
1849 },
1850 'align=right,n_start=0' =>
1851 { Y_axis => 'A006046',
1852 Depth_start => 'A006046',
1853 # OEIS-Catalogue: A006046 planepath=SierpinskiTriangle,align=diagonal,n_start=0 line_type=Y_axis
1854 },
1855 'align=left,n_start=0' =>
1856 { Diagonal_NW => 'A006046',
1857 Depth_start => 'A006046',
1858 # OEIS-Other: A006046 planepath=SierpinskiTriangle,align=left,n_start=0 line_type=Diagonal_NW
1859 },
1860 'align=diagonal,n_start=0' =>
1861 { Y_axis => 'A006046',
1862 Depth_start => 'A006046',
1863 # OEIS-Other: A006046 planepath=SierpinskiTriangle,align=diagonal,n_start=0 line_type=Y_axis
1864 },
1865  
1866 #---------
1867 # i_start=1, n_start=0
1868  
1869 # starting OFFSET=1 value=2,4,8,10 so missing N=0 at Y=0, hence i_start=1
1870 'align=triangular,n_start=0,i_start=1' =>
1871 { Diagonal => 'A074330',
1872 Depth_end => 'A074330',
1873 # OEIS-Catalogue: A074330 planepath=SierpinskiTriangle line_type=Diagonal i_start=1
1874 # OEIS-Other: A074330 planepath=SierpinskiTriangle line_type=Depth_end i_start=1
1875 },
1876 'align=right,n_start=0,i_start=1' =>
1877 { Diagonal => 'A074330',
1878 Depth_end => 'A074330',
1879 # OEIS-Other: A074330 planepath=SierpinskiTriangle,align=right line_type=Diagonal i_start=1
1880 },
1881 'align=left,n_start=0,i_start=1' =>
1882 { Y_axis => 'A074330',
1883 Depth_end => 'A074330',
1884 # OEIS-Other: A074330 planepath=SierpinskiTriangle,align=left line_type=Y_axis i_start=1
1885 },
1886 'align=diagonal,n_start=0,i_start=1' =>
1887 { X_axis => 'A074330',
1888 Depth_end => 'A074330',
1889 # OEIS-Other: A074330 planepath=SierpinskiTriangle,align=diagonal i_start=1
1890 },
1891 };
1892 }
1893 { package Math::PlanePath::SierpinskiArrowhead;
1894 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1895 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1896 use constant _NumSeq_Diagonal_NW_increasing => 1;
1897 # align="diagonal" is X increasing, other align is single origin point only
1898 use constant _NumSeq_X_axis_increasing => 1;
1899 }
1900 { package Math::PlanePath::SierpinskiArrowheadCentres;
1901 use constant _NumSeq_Y_axis_increasing => 1; # never touched ?
1902 use constant _NumSeq_Diagonal_increasing => 1;
1903 use constant _NumSeq_Diagonal_NW_increasing => 1;
1904 # align="diagonal" is X increasing, other align is single origin point only
1905 use constant _NumSeq_X_axis_increasing => 1;
1906 }
1907 { package Math::PlanePath::SierpinskiCurve;
1908 use constant _NumSeq_X_axis_increasing => 1; # when touched
1909 use constant _NumSeq_X_axis_i_start => 1; # but not all cells visited
1910  
1911 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1912 use constant _NumSeq_Y_axis_i_start => 1; # but not all cells visited
1913  
1914 use constant _NumSeq_X_neg_increasing => 1; # arms
1915 use constant _NumSeq_Y_neg_increasing => 1; # arms
1916  
1917 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1918 use constant _NumSeq_Diagonal_NW_increasing => 1;
1919  
1920 use constant _NumSeq_Diagonal_SW_increasing => 1;
1921 use constant _NumSeq_Diagonal_SE_increasing => 1;
1922 }
1923 { package Math::PlanePath::SierpinskiCurveStair;
1924 use constant _NumSeq_X_axis_increasing => 1; # when touched
1925 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1926 use constant _NumSeq_X_neg_increasing => 1; # arms
1927 use constant _NumSeq_Y_neg_increasing => 1; # arms
1928 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1929 use constant _NumSeq_Diagonal_NW_increasing => 1;
1930 use constant _NumSeq_Diagonal_SW_increasing => 1;
1931 use constant _NumSeq_Diagonal_SE_increasing => 1;
1932 }
1933 { package Math::PlanePath::HIndexing;
1934 use constant _NumSeq_X_axis_increasing => 1; # when touched
1935 use constant _NumSeq_Y_axis_increasing => 1;
1936 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1937 }
1938 # { package Math::PlanePath::DragonCurve;
1939 # }
1940 # { package Math::PlanePath::DragonRounded;
1941 # }
1942 # { package Math::PlanePath::DragonMidpoint;
1943 # }
1944 { package Math::PlanePath::AlternatePaper;
1945 use constant _NumSeq_X_axis_increasing => 1;
1946 use constant _NumSeq_Y_axis_increasing => 1;
1947 use constant _NumSeq_Diagonal_increasing => 1;
1948 use constant _NumSeq_Diagonal_NW_increasing => 1; # arms
1949 use constant _NumSeq_Diagonal_SW_increasing => 1;
1950 use constant _NumSeq_Diagonal_SE_increasing => 1;
1951 # selecting the smaller N on the negative axes gives increasing, maybe
1952 use constant _NumSeq_X_neg_increasing => 1;
1953 use constant _NumSeq_Y_neg_increasing => 1;
1954  
1955 use constant _NumSeq_N_oeis_anum =>
1956 { 'arms=1' =>
1957 { X_axis => 'A000695', # base 4 digits 0,1 only
1958 Diagonal => 'A062880', # base 4 digits 0,2 only
1959 # OEIS-Other: A000695 planepath=AlternatePaper
1960 # OEIS-Other: A062880 planepath=AlternatePaper line_type=Diagonal
1961 },
1962 # FIXME: not sure what to do when multiple-visited points on axes
1963 # 'arms=2' =>
1964 # { X_axis => 'A062880', # base 4 digits 0,2 only
1965 # Y_axis => 'A145812', # base 4 digits 0,2 only except low digit 1,3 only
1966 # # OEIS-Other: A062880 planepath=AlternatePaper,arms=2
1967 # # OEIS-Catalogue: A145812 planepath=AlternatePaper,arms=2 line_type=Y_axis
1968 # },
1969 # 'arms=3' =>
1970 # { X_axis => 'A001196', # base 4 digits 0,3 only
1971 # # OEIS-Other: A001196 planepath=AlternatePaper,arms=3
1972 # },
1973 #
1974 # alt paper arms=4 diagonal, arms=8 x axis
1975 # A127988 # base 8 digits 0,4 only
1976 };
1977 }
1978 { package Math::PlanePath::AlternatePaperMidpoint;
1979 use constant _NumSeq_X_axis_increasing => 1;
1980 use constant _NumSeq_Y_axis_increasing => 1;
1981 use constant _NumSeq_Diagonal_increasing => 1;
1982 use constant _NumSeq_Diagonal_NW_increasing => 1; # arms
1983 use constant _NumSeq_Diagonal_SE_increasing => 1; # arms
1984 }
1985 # { package Math::PlanePath::TerdragonCurve;
1986 # }
1987 # { package Math::PlanePath::TerdragonRounded;
1988 # }
1989 # { package Math::PlanePath::TerdragonMidpoint;
1990 # }
1991 # { package Math::PlanePath::AlternateTerdragon;
1992 # }
1993 # { package Math::PlanePath::R5DragonCurve;
1994 # }
1995 # { package Math::PlanePath::R5DragonMidpoint;
1996 # }
1997 # { package Math::PlanePath::CCurve;
1998 # }
1999 # { package Math::PlanePath::ComplexPlus;
2000 # }
2001 { package Math::PlanePath::ComplexMinus;
2002 use constant _NumSeq_N_oeis_anum =>
2003 { 'realpart=1' =>
2004 { X_axis => 'A066321', # binary base i-1
2005 X_neg => 'A256441', # binary base i-1
2006 # OEIS-Catalogue: A066321 planepath=ComplexMinus
2007 # OEIS-Catalogue: A256441 planepath=ComplexMinus line_type=X_neg
2008 # cf A066323 count of 1-bits in N on X axis
2009 },
2010 };
2011 }
2012 # { package Math::PlanePath::ComplexRevolving;
2013 # }
2014 { package Math::PlanePath::Rows;
2015 use constant _NumSeq_X_axis_increasing => 1;
2016 use constant _NumSeq_Y_axis_increasing => 1;
2017 use constant _NumSeq_Diagonal_increasing => 1;
2018 use constant _NumSeq_Y_neg_min => undef; # negatives
2019 use constant _NumSeq_Y_neg_max => 1; # negatives
2020  
2021 # secret negatives
2022 # (w-1)*(w-1)-1
2023 # = w^2-2w+1-1
2024 # = w(w-2)
2025 sub _NumSeq_Diagonal_SE_min {
2026 my ($self) = @_;
2027 return ($self->{'width'}-2)*$self->{'width'};
2028 }
2029  
2030 use constant _NumSeq_N_oeis_anum =>
2031 {
2032 'n_start=0,width=1' =>
2033 { X_axis => 'A001477', # integers 0,1,2,3,etc
2034 # OEIS-Other: A001477 planepath=Rows,width=1,n_start=0
2035 },
2036 'n_start=1,width=2' =>
2037 { Y_axis => 'A005408', # odd 2n+1
2038 # OEIS-Other: A005408 planepath=Rows,width=2 line_type=Y_axis
2039 },
2040 'n_start=1,width=3' =>
2041 { Y_axis => 'A016777', # 3n+1
2042 # OEIS-Catalogue: A016777 planepath=Rows,width=3 line_type=Y_axis
2043 },
2044 'n_start=1,width=4' =>
2045 { Y_axis => 'A016813', # 4n+1
2046 # OEIS-Catalogue: A016813 planepath=Rows,width=4 line_type=Y_axis
2047 },
2048  
2049 'n_start=1,width=5' =>
2050 { Y_axis => 'A016861', # 5n+1
2051 # OEIS-Catalogue: A016861 planepath=Rows,width=5 line_type=Y_axis
2052 },
2053 'n_start=1,width=6' =>
2054 { Y_axis => 'A016921', # 6n+1
2055 # OEIS-Catalogue: A016921 planepath=Rows,width=6 line_type=Y_axis
2056 },
2057 'n_start=1,width=7' =>
2058 { Y_axis => 'A016993', # 7n+1
2059 # OEIS-Catalogue: A016993 planepath=Rows,width=7 line_type=Y_axis
2060 },
2061 };
2062 }
2063 { package Math::PlanePath::Columns;
2064 use constant _NumSeq_X_axis_increasing => 1;
2065 use constant _NumSeq_Y_axis_increasing => 1;
2066 use constant _NumSeq_Diagonal_increasing => 1;
2067 use constant _NumSeq_X_neg_min => undef; # negatives
2068 use constant _NumSeq_X_neg_max => 1; # negatives
2069  
2070 sub _NumSeq_Diagonal_NW_min {
2071 my ($self) = @_;
2072 # secret negatives
2073 return ($self->{'height'}-2)*$self->{'height'};
2074 }
2075 use constant _NumSeq_N_oeis_anum =>
2076 {
2077 'n_start=0,height=1' =>
2078 { X_axis => 'A001477', # integers 0,1,2,3,etc
2079 # OEIS-Other: A001477 planepath=Columns,height=1,n_start=0
2080 },
2081 'n_start=1,height=2' =>
2082 { X_axis => 'A005408', # odd 2n+1
2083 # OEIS-Other: A005408 planepath=Columns,height=2
2084 },
2085 'n_start=1,height=3' =>
2086 { X_axis => 'A016777', # 3n+1
2087 # OEIS-Other: A016777 planepath=Columns,height=3
2088 },
2089 'n_start=1,height=4' =>
2090 { X_axis => 'A016813', # 4n+1
2091 # OEIS-Other: A016813 planepath=Columns,height=4
2092 },
2093 'n_start=1,height=5' =>
2094 { X_axis => 'A016861', # 5n+1
2095 # OEIS-Other: A016861 planepath=Columns,height=5
2096 },
2097 'n_start=1,height=6' =>
2098 { X_axis => 'A016921', # 6n+1
2099 # OEIS-Other: A016921 planepath=Columns,height=6
2100 },
2101 'n_start=1,height=7' =>
2102 { X_axis => 'A016993', # 7n+1
2103 # OEIS-Other: A016993 planepath=Columns,height=7
2104 },
2105 };
2106 }
2107 { package Math::PlanePath::Diagonals;
2108 use constant _NumSeq_X_axis_increasing => 1;
2109 use constant _NumSeq_Y_axis_increasing => 1;
2110 use constant _NumSeq_Diagonal_increasing => 1;
2111  
2112 use constant _NumSeq_N_oeis_anum =>
2113 { 'direction=down,n_start=1,x_start=0,y_start=0' =>
2114 {
2115 # Diagonals X_axis -- triangular 1,3,6,etc, but starting i=0 value=1
2116 Y_axis => 'A000124', # triangular+1 = n*(n+1)/2+1
2117 Diagonal => 'A001844', # centred squares 2n(n+1)+1
2118 # OEIS-Catalogue: A000124 planepath=Diagonals line_type=Y_axis
2119 # OEIS-Catalogue: A001844 planepath=Diagonals line_type=Diagonal
2120 },
2121 'direction=up,n_start=1,x_start=0,y_start=0' =>
2122 {
2123 X_axis => 'A000124', # triangular+1 = n*(n+1)/2+1
2124 Diagonal => 'A001844', # centred squares 2n(n+1)+1
2125 # OEIS-Other: A000124 planepath=Diagonals,direction=up
2126 # OEIS-Other: A001844 planepath=Diagonals,direction=up line_type=Diagonal
2127 },
2128  
2129 'direction=down,n_start=0,x_start=0,y_start=0' =>
2130 {
2131 X_axis => 'A000096', # n*(n+3)/2
2132 Y_axis => 'A000217', # triangular n*(n+1)/2
2133 # OEIS-Other: A000096 planepath=Diagonals,n_start=0
2134 # OEIS-Other: A000217 planepath=Diagonals,n_start=0 line_type=Y_axis
2135 },
2136 'direction=up,n_start=0,x_start=0,y_start=0' =>
2137 {
2138 X_axis => 'A000217', # triangular n*(n+1)/2
2139 Y_axis => 'A000096', # n*(n+3)/2
2140 # OEIS-Other: A000217 planepath=Diagonals,direction=up,n_start=0
2141 # OEIS-Other: A000096 planepath=Diagonals,direction=up,n_start=0 line_type=Y_axis
2142 },
2143 };
2144 }
2145 { package Math::PlanePath::DiagonalsAlternating;
2146 use constant _NumSeq_X_axis_increasing => 1;
2147 use constant _NumSeq_Y_axis_increasing => 1;
2148 use constant _NumSeq_Diagonal_increasing => 1;
2149  
2150 use constant _NumSeq_N_oeis_anum =>
2151 { 'n_start=1' =>
2152 { Diagonal => 'A001844', # centred squares 2n(n+1)+1
2153 # OEIS-Other: A001844 planepath=DiagonalsAlternating line_type=Diagonal
2154  
2155 # Not quite, extra initial 1 or 0
2156 # X_axis => 'A128918',
2157 # Y_axis => 'A131179',
2158 },
2159 'n_start=0' =>
2160 { Diagonal => 'A046092', # 2*triangular
2161 # OEIS-Other: A046092 planepath=DiagonalsAlternating,n_start=0 line_type=Diagonal
2162 },
2163 };
2164 }
2165 { package Math::PlanePath::DiagonalsOctant;
2166 use constant _NumSeq_X_axis_increasing => 1;
2167 use constant _NumSeq_Y_axis_increasing => 1;
2168 use constant _NumSeq_Diagonal_increasing => 1;
2169  
2170 use constant _NumSeq_N_oeis_anum =>
2171 {
2172 # 'direction=down,n_start=1' =>
2173 # {
2174 # Not quite, starting i=0 for square=1 cf A000290 starts 0
2175 # # Diagonal => 'A000290', # squares
2176 #
2177 # Not quite, A033638 extra initial 1
2178 # # Y_axis => 'A033638', # quarter squares + 1, 1,1,2,3,5,7,10,13
2179 # }
2180  
2181 # 'direction=up,n_start=1' =>
2182 # {
2183 # # Not quite, A002061 extra initial 1
2184 # # Diagonal => 'A002061', # 1,1,3,7,13,21,31,43
2185 # }
2186  
2187 'direction=down,n_start=0' =>
2188 { Diagonal => 'A005563', # n*(n+2) 0,3,8,15,24
2189 # OEIS-Other: A005563 planepath=DiagonalsOctant,n_start=0 line_type=Diagonal
2190  
2191 # # Not quite, extra initial 0
2192 # # Y_axis => 'A002620', # quarter squares 0,0,1,2,4,6,9,12,
2193 },
2194  
2195 'direction=up,n_start=0' =>
2196 { Diagonal => 'A002378', # pronic 0,2,6,12,20
2197 # OEIS-Other: A002378 planepath=DiagonalsOctant,direction=up,n_start=0 line_type=Diagonal
2198  
2199 # # Not quite, starts n=1 value=0 whereas start Y=0 value=0 here
2200 # # Y_axis => 'A024206', # 0,1,3,5,8,11,15
2201 },
2202 };
2203 }
2204 { package Math::PlanePath::MPeaks;
2205 use constant _NumSeq_X_axis_increasing => 1;
2206 use constant _NumSeq_Y_axis_increasing => 1;
2207 use constant _NumSeq_X_neg_increasing => 0;
2208 use constant _NumSeq_X_neg_increasing_from_i => 1;
2209 use constant _NumSeq_X_neg_min => 1; # at X=-1,Y=0 rather than X=0,Y=0
2210 use constant _NumSeq_Diagonal_increasing => 1;
2211 use constant _NumSeq_Diagonal_NW_increasing_from_i => 1;
2212 use constant _NumSeq_Diagonal_NW_min => 2; # at X=-1,Y=1
2213  
2214 # MPeaks -- X_axis A045944 matchstick n(3n+2) but initial N=3
2215 # MPeaks -- Diagonal,Y_axis hexagonal first,second spoke, but starting
2216 # from 3
2217 }
2218 { package Math::PlanePath::Staircase;
2219 use constant _NumSeq_X_axis_increasing => 1;
2220 use constant _NumSeq_Diagonal_increasing => 1;
2221  
2222 use constant _NumSeq_N_oeis_anum =>
2223 {
2224 'n_start=1' =>
2225 { Diagonal => 'A084849',
2226 # OEIS-Other: A084849 planepath=Staircase line_type=Diagonal
2227 },
2228  
2229 'n_start=0' =>
2230 { Diagonal => 'A014105', # second hexagonals
2231 # OEIS-Other: A014105 planepath=Staircase,n_start=0 line_type=Diagonal
2232 },
2233  
2234 'n_start=2' =>
2235 { Diagonal => 'A096376',
2236 # OEIS-Catalogue: A096376 planepath=Staircase,n_start=2 line_type=Diagonal
2237  
2238 # Not quite, A128918 has extra initial 1,1
2239 # X_axis => 'A128918',
2240 },
2241 };
2242 }
2243 { package Math::PlanePath::StaircaseAlternating;
2244 sub _NumSeq_X_axis_increasing {
2245 my ($self) = @_;
2246 return ($self->{'end_type'} eq 'square'
2247 ? 1
2248 : 0); # backs-up
2249 }
2250 *_NumSeq_Y_axis_increasing = \&_NumSeq_X_axis_increasing;
2251 use constant _NumSeq_Diagonal_increasing => 1;
2252  
2253 use constant _NumSeq_N_oeis_anum =>
2254 {
2255 'end_type=jump,n_start=1' =>
2256 { Diagonal => 'A084849',
2257 # OEIS-Other: A084849 planepath=StaircaseAlternating line_type=Diagonal
2258 },
2259 'end_type=jump,n_start=0' =>
2260 { Diagonal => 'A014105', # second hexagonals
2261 # OEIS-Other: A014105 planepath=StaircaseAlternating,n_start=0 line_type=Diagonal
2262 },
2263 'end_type=jump,n_start=2' =>
2264 { Diagonal => 'A096376',
2265 # OEIS-Other: A096376 planepath=StaircaseAlternating,n_start=2 line_type=Diagonal
2266 },
2267  
2268 'end_type=square,n_start=1' =>
2269 { Diagonal => 'A058331',
2270 # OEIS-Other: A058331 planepath=StaircaseAlternating,end_type=square line_type=Diagonal
2271 },
2272 'end_type=square,n_start=0' =>
2273 { Diagonal => 'A001105',
2274 # OEIS-Other: A001105 planepath=StaircaseAlternating,end_type=square,n_start=0 line_type=Diagonal
2275 },
2276 };
2277 }
2278 { package Math::PlanePath::Corner;
2279 use constant _NumSeq_X_axis_increasing => 1;
2280 use constant _NumSeq_Y_axis_increasing => 1;
2281 use constant _NumSeq_Diagonal_increasing => 1;
2282  
2283 use constant _NumSeq_N_oeis_anum =>
2284 { 'wider=0,n_start=1' =>
2285 { Y_axis => 'A002522', # n^2+1
2286 # OEIS-Other: A002522 planepath=Corner line_type=Y_axis
2287 },
2288 'wider=0,n_start=0' =>
2289 { X_axis => 'A005563', # (n+1)^2-1
2290 Y_axis => 'A000290', # squares
2291 Diagonal => 'A002378', # pronic
2292 # OEIS-Other: A005563 planepath=Corner,n_start=0
2293 # OEIS-Other: A000290 planepath=Corner,n_start=0 line_type=Y_axis
2294 # OEIS-Other: A002378 planepath=Corner,n_start=0 line_type=Diagonal
2295 },
2296 'wider=0,n_start=2' =>
2297 { Y_axis => 'A059100', # n^2+2
2298 Diagonal => 'A014206', # pronic+2
2299 # OEIS-Catalogue: A059100 planepath=Corner,n_start=2 line_type=Y_axis
2300 # OEIS-Catalogue: A014206 planepath=Corner,n_start=2 line_type=Diagonal
2301 },
2302  
2303 'wider=1,n_start=0' =>
2304 { Y_axis => 'A002378', # pronic
2305 Diagonal => 'A005563', # (n+1)^2-1
2306 # OEIS-Other: A002378 planepath=Corner,wider=1,n_start=0 line_type=Y_axis
2307 # OEIS-Other: A005563 planepath=Corner,wider=1,n_start=0 line_type=Diagonal
2308 },
2309 'wider=1,n_start=2' =>
2310 { Y_axis => 'A014206', # pronic+2
2311 # OEIS-Other: A014206 planepath=Corner,wider=1,n_start=2 line_type=Y_axis
2312 },
2313  
2314 'wider=2,n_start=0' =>
2315 { Y_axis => 'A005563', # (n+1)^2-1
2316 Diagonal => 'A028552', # n(n+3)
2317 # OEIS-Other: A005563 planepath=Corner,wider=2,n_start=0 line_type=Y_axis
2318 # OEIS-Catalogue: A028552 planepath=Corner,wider=2,n_start=0 line_type=Diagonal
2319 },
2320 'wider=2,n_start=1' =>
2321 { Diagonal => 'A028387', # n(n+3)+1 = n + (n+1)^2
2322 # OEIS-Catalogue: A028387 planepath=Corner,wider=2,n_start=1 line_type=Diagonal
2323 },
2324  
2325 'wider=3,n_start=0' =>
2326 { Y_axis => 'A028552', # n(n+3)
2327 # OEIS-Other: A028552 planepath=Corner,wider=3,n_start=0 line_type=Y_axis
2328 },
2329 };
2330 }
2331 { package Math::PlanePath::PyramidRows;
2332 use constant _NumSeq_Y_axis_increasing => 1;
2333 use constant _NumSeq_Diagonal_increasing => 1; # when covered, or single
2334 use constant _NumSeq_Diagonal_NW_increasing => 1;
2335  
2336 use constant _NumSeq_N_oeis_anum =>
2337 {
2338 # PyramidRows step=1
2339 do {
2340 my $href =
2341 { Y_axis => 'A000124', # triangular+1 = n*(n+1)/2+1
2342 };
2343 ('step=1,align=centre,n_start=1' => $href,
2344 'step=1,align=right,n_start=1' => $href);
2345  
2346 # OEIS-Other: A000124 planepath=PyramidRows,step=1 line_type=Y_axis
2347 # OEIS-Other: A000124 planepath=PyramidRows,step=1,align=right line_type=Y_axis
2348 },
2349 'step=1,align=left,n_start=1' =>
2350 { Diagonal_NW => 'A000124', # triangular+1 = n*(n+1)/2+1
2351 # OEIS-Other: A000124 planepath=PyramidRows,step=1,align=left line_type=Diagonal_NW
2352 },
2353 do {
2354 my $href =
2355 { Y_axis => 'A000217', # triangular
2356 };
2357 ('step=1,align=centre,n_start=0' => $href,
2358 'step=1,align=right,n_start=0' => $href);
2359  
2360 # OEIS-Other: A000217 planepath=PyramidRows,step=1,n_start=0 line_type=Y_axis
2361 # OEIS-Other: A000217 planepath=PyramidRows,step=1,align=right,n_start=0 line_type=Y_axis
2362 },
2363  
2364 'step=2,align=centre,n_start=1' =>
2365 { Diagonal_NW => 'A002522', # n^2+1
2366 # OEIS-Other: A002522 planepath=PyramidRows,step=2 line_type=Diagonal_NW
2367  
2368 # Not quite, n_start=1 means squares starting from 1 whereas A000290
2369 # starts from 0
2370 # Diagonal => 'A000290',
2371 },
2372 'step=2,align=centre,n_start=0' =>
2373 { Y_axis => 'A002378', # pronic
2374 Diagonal => 'A005563',
2375 Diagonal_NW => 'A000290', # squares
2376 # OEIS-Other: A002378 planepath=PyramidRows,step=2,n_start=0 line_type=Y_axis
2377 # OEIS-Other: A005563 planepath=PyramidRows,step=2,n_start=0 line_type=Diagonal
2378 # OEIS-Other: A000290 planepath=PyramidRows,step=2,n_start=0 line_type=Diagonal_NW
2379 },
2380 'step=2,align=right,n_start=0' =>
2381 { Y_axis => 'A000290', # squares
2382 Diagonal => 'A002378', # pronic
2383 # OEIS-Other: A000290 planepath=PyramidRows,step=2,align=right,n_start=0 line_type=Y_axis
2384 # OEIS-Other: A002378 planepath=PyramidRows,step=2,align=right,n_start=0 line_type=Diagonal
2385 },
2386 'step=2,align=left,n_start=0' =>
2387 { Y_axis => 'A005563',
2388 Diagonal_NW => 'A002378', # pronic
2389 # OEIS-Other: A005563 planepath=PyramidRows,step=2,align=left,n_start=0 line_type=Y_axis
2390 # OEIS-Other: A002378 planepath=PyramidRows,step=2,align=left,n_start=0 line_type=Diagonal_NW
2391 },
2392 'step=2,align=centre,n_start=2' =>
2393 { Diagonal_NW => 'A059100', # n^2+2
2394 # OEIS-Other: A059100 planepath=PyramidRows,step=2,n_start=2 line_type=Diagonal_NW
2395 },
2396 'step=2,align=right,n_start=2' =>
2397 { Y_axis => 'A059100', # n^2+2
2398 # OEIS-Other: A059100 planepath=PyramidRows,step=2,align=right,n_start=2 line_type=Y_axis
2399 },
2400  
2401 'step=3,align=centre,n_start=1' =>
2402 { Y_axis => 'A104249',
2403 Diagonal_NW => 'A143689',
2404 # OEIS-Catalogue: A104249 planepath=PyramidRows,step=3 line_type=Y_axis
2405 # OEIS-Catalogue: A143689 planepath=PyramidRows,step=3 line_type=Diagonal_NW
2406 # Not quite OFFSET=1 cf start i=0 here
2407 # Diagonal => 'A005448',
2408 # # OEIS-Catalogue: A005448 planepath=PyramidRows,step=3 line_type=Diagonal
2409 },
2410 'step=3,align=right,n_start=1' =>
2411 { Y_axis => 'A143689',
2412 Diagonal => 'A104249',
2413 # OEIS-Other: A143689 planepath=PyramidRows,step=3,align=right line_type=Y_axis
2414 # OEIS-Other: A104249 planepath=PyramidRows,step=3,align=right line_type=Diagonal
2415  
2416 # Not quite OFFSET=1 cf start i=0 here
2417 # Diagonal => 'A005448',
2418 # # OEIS-Catalogue: A005448 planepath=PyramidRows,step=3 line_type=Diagonal
2419 },
2420 'step=3,align=centre,n_start=0' =>
2421 { Y_axis => 'A005449', # second pentagonal n*(3n+1)/2
2422 Diagonal_NW => 'A000326', # pentagonal n(3n-1)/2
2423 # OEIS-Other: A005449 planepath=PyramidRows,step=3,n_start=0 line_type=Y_axis
2424 # OEIS-Other: A000326 planepath=PyramidRows,step=3,n_start=0 line_type=Diagonal_NW
2425 },
2426 'step=3,align=right,n_start=0' =>
2427 { Y_axis => 'A000326', # pentagonal n(3n-1)/2
2428 Diagonal => 'A005449', # second pentagonal n*(3n+1)/2
2429 # OEIS-Other: A000326 planepath=PyramidRows,step=3,align=right,n_start=0 line_type=Y_axis
2430 # OEIS-Other: A005449 planepath=PyramidRows,step=3,align=right,n_start=0 line_type=Diagonal
2431 },
2432  
2433 'step=4,align=centre,n_start=1' =>
2434 { Y_axis => 'A084849',
2435 Diagonal => 'A001844',
2436 Diagonal_NW => 'A058331',
2437 # OEIS-Catalogue: A084849 planepath=PyramidRows,step=4 line_type=Y_axis
2438 # OEIS-Other: A001844 planepath=PyramidRows,step=4 line_type=Diagonal
2439 # OEIS-Other: A058331 planepath=PyramidRows,step=4 line_type=Diagonal_NW
2440 },
2441 'step=4,align=right,n_start=1' =>
2442 { Diagonal => 'A058331',
2443 # OEIS-Other: A058331 planepath=PyramidRows,step=4,align=right line_type=Diagonal
2444 },
2445 'step=4,align=left,n_start=1' =>
2446 { Diagonal_NW => 'A001844',
2447 # OEIS-Other: A001844 planepath=PyramidRows,step=4,align=left line_type=Diagonal_NW
2448 },
2449 'step=4,align=centre,n_start=0' =>
2450 { Y_axis => 'A014105', # second hexagonal
2451 Diagonal => 'A046092', # 4*triangular
2452 Diagonal_NW => 'A001105', # 2*n^2
2453 # OEIS-Other: A014105 planepath=PyramidRows,step=4,n_start=0 line_type=Y_axis
2454 # OEIS-Catalogue: A046092 planepath=PyramidRows,step=4,n_start=0 line_type=Diagonal
2455 # OEIS-Other: A001105 planepath=PyramidRows,step=4,n_start=0 line_type=Diagonal_NW
2456 },
2457 'step=4,align=right,n_start=0' =>
2458 { Y_axis => 'A000384', # 2*n^2-n, hexagonal numbers
2459 Diagonal => 'A001105',
2460 # OEIS-Other: A000384 planepath=PyramidRows,step=4,align=right,n_start=0 line_type=Y_axis
2461 # OEIS-Other: A001105 planepath=PyramidRows,step=4,align=right,n_start=0 line_type=Diagonal
2462 },
2463 'step=4,align=left,n_start=0' =>
2464 { Diagonal_NW => 'A046092', # 4*triangular
2465 # OEIS-Other: A046092 planepath=PyramidRows,step=4,align=left,n_start=0 line_type=Diagonal_NW
2466 },
2467  
2468 # TODO PyramidRows,step=5 n_start=0
2469  
2470 'step=5,align=centre,n_start=1' =>
2471 { Y_axis => 'A116668',
2472 # OEIS-Other: A116668 planepath=PyramidRows,step=5 line_type=Y_axis
2473 },
2474 'step=6,align=centre,n_start=1' =>
2475 { Diagonal_NW => 'A056107',
2476 Y_axis => 'A056108',
2477 Diagonal => 'A056109',
2478 # OEIS-Other: A056107 planepath=PyramidRows,step=6 line_type=Diagonal_NW
2479 # OEIS-Other: A056108 planepath=PyramidRows,step=6 line_type=Y_axis
2480 # OEIS-Other: A056109 planepath=PyramidRows,step=6 line_type=Diagonal
2481 },
2482 'step=8,align=centre,n_start=1' =>
2483 { Diagonal_NW => 'A053755',
2484 # OEIS-Other: A053755 planepath=PyramidRows,step=8 line_type=Diagonal_NW
2485 },
2486 'step=9,align=centre,n_start=1' =>
2487 { Y_axis => 'A006137',
2488 Diagonal => 'A038764',
2489 # OEIS-Other: A006137 planepath=PyramidRows,step=9 line_type=Y_axis
2490 # OEIS-Other: A038764 planepath=PyramidRows,step=9 line_type=Diagonal
2491 },
2492 };
2493 }
2494 { package Math::PlanePath::PyramidSides;
2495 use constant _NumSeq_X_axis_increasing => 1;
2496 use constant _NumSeq_Y_axis_increasing => 1;
2497 use constant _NumSeq_X_neg_increasing => 1;
2498 use constant _NumSeq_Diagonal_increasing => 1;
2499 use constant _NumSeq_Diagonal_NW_increasing => 1;
2500  
2501 use constant _NumSeq_N_oeis_anum =>
2502 { 'n_start=1' =>
2503 { X_neg => 'A002522',
2504 Diagonal => 'A033951',
2505 # OEIS-Catalogue: A002522 planepath=PyramidSides line_type=X_neg
2506 # OEIS-Other: A033951 planepath=PyramidSides line_type=Diagonal
2507 #
2508 # X_axis -- squares (x+1)^2, but starting i=0 value=1
2509 } };
2510 }
2511 { package Math::PlanePath::CellularRule;
2512 use constant _NumSeq_Y_axis_increasing => 1;
2513 use constant _NumSeq_Diagonal_increasing => 1;
2514 use constant _NumSeq_Diagonal_NW_increasing => 1;
2515  
2516 use constant _NumSeq_N_oeis_anum =>
2517 { 'rule=5,n_start=1' =>
2518 { Y_axis => 'A061925', # ceil(n^2/2)+1
2519 # OEIS-Catalogue: A061925 planepath=CellularRule,rule=5 line_type=Y_axis
2520 },
2521  
2522 # rule 84,116,212,244 two-wide right line
2523 do {
2524 my $tworight
2525 = { Diagonal => 'A005408', # odds 2n+1
2526 };
2527 ('rule=84,n_start=1' => $tworight,
2528 'rule=116,n_start=1' => $tworight,
2529 'rule=212,n_start=1' => $tworight,
2530 'rule=244,n_start=1' => $tworight,
2531 );
2532  
2533 # OEIS-Other: A005408 planepath=CellularRule,rule=84 line_type=Diagonal
2534 # OEIS-Other: A005408 planepath=CellularRule,rule=116 line_type=Diagonal
2535 # OEIS-Other: A005408 planepath=CellularRule,rule=212 line_type=Diagonal
2536 # OEIS-Other: A005408 planepath=CellularRule,rule=244 line_type=Diagonal
2537 },
2538 'rule=77,n_start=1' =>
2539 { Y_axis => 'A000124', # triangular+1
2540 # OEIS-Other: A000124 planepath=CellularRule,rule=77 line_type=Y_axis
2541 },
2542 'rule=177,n_start=1' =>
2543 { Diagonal => 'A000124', # triangular+1
2544 # OEIS-Other: A000124 planepath=CellularRule,rule=177 line_type=Diagonal
2545 },
2546 'rule=185,n_start=1' =>
2547 { Diagonal => 'A002522', # n^2+1
2548 # OEIS-Other: A002522 planepath=CellularRule,rule=185 line_type=Diagonal
2549 },
2550 'rule=189,n_start=1' =>
2551 { Y_axis => 'A002522', # n^2+1
2552 # OEIS-Other: A002522 planepath=CellularRule,rule=189 line_type=Y_axis
2553 },
2554 # PyramidRows step=1,align=left
2555 # OEIS-Other: A000124 planepath=CellularRule,rule=206 line_type=Diagonal_NW
2556 # OEIS-Other: A000124 planepath=CellularRule,rule=238 line_type=Diagonal_NW
2557  
2558 do {
2559 my $solidgapright
2560 = { Diagonal => 'A002522', # n^2+1
2561 };
2562 ('rule=209,n_start=1' => $solidgapright,
2563 'rule=241,n_start=1' => $solidgapright,
2564 );
2565 # OEIS-Other: A002522 planepath=CellularRule,rule=209 line_type=Diagonal
2566 # OEIS-Other: A002522 planepath=CellularRule,rule=241 line_type=Diagonal
2567 },
2568 'rule=29,n_start=1' =>
2569 { Y_axis => 'A000124', # triangular+1
2570 # OEIS-Other: A000124 planepath=CellularRule,rule=29 line_type=Y_axis
2571 },
2572 'rule=221,n_start=1' =>
2573 { Y_axis => 'A002522', # n^2+1
2574 # OEIS-Other: A002522 planepath=CellularRule,rule=221 line_type=Y_axis
2575 },
2576 'rule=229,n_start=1' =>
2577 { Y_axis => 'A002522', # n^2+1
2578 # OEIS-Other: A002522 planepath=CellularRule,rule=229 line_type=Y_axis
2579 },
2580 #
2581 # rule=13 Y axis
2582 #
2583 # rule=28,156
2584 # Y_axis => 'A002620', quarter squares floor(n^2/4) but diff start
2585 # Diagonal => 'A024206', quarter squares - 1, but diff start
2586 #
2587 # A000027 naturals integers 1 upwards, but OFFSET=1 cf start Y=0 here
2588 # # central column only
2589 # 'rule=4' =>
2590 # { Y_axis => 'A000027', # 1 upwards
2591 # # OEIS-Other: A000027 planepath=CellularRule,rule=4 line_type=Y_axis
2592 # },
2593 #
2594 # # right line only rule=16,24,48,56,80,88,112,120,144,152,176,184,208,216,240,248
2595 # Not quite A000027 OFFSET=1 vs start X=Y=0 here
2596 # 'rule=16' =>
2597 # { Y_axis => 'A000027', # 1 upwards
2598 # # OEIS-Other: A000027 planepath=CellularRule,rule=16 line_type=Diagonal
2599 # },
2600 };
2601 }
2602 {
2603 package Math::PlanePath::CellularRule::Line;
2604 use constant _NumSeq_Y_axis_increasing => 1;
2605 use constant _NumSeq_Diagonal_increasing => 1;
2606 use constant _NumSeq_Diagonal_NW_increasing => 1;
2607 }
2608 {
2609 package Math::PlanePath::CellularRule::OneTwo;
2610 use constant _NumSeq_Y_axis_increasing => 1;
2611 use constant _NumSeq_Diagonal_increasing => 1;
2612 use constant _NumSeq_Diagonal_NW_increasing => 1;
2613  
2614 # use constant _NumSeq_N_oeis_anum =>
2615 # { 'align=left,n_start=1' =>
2616 # {
2617 # Not quite, OFFSET=1 cf coordinate X=0 here
2618 # Diagonal_NW => 'A001651', # not divisible by 3
2619 # },
2620  
2621 # { 'align=right,n_start=1' =>
2622 # Not quite, A032766 0 or 1 mod 3, but it starts OFFSET=0 value=0
2623 # whereas path start 1,3,4,etc without initial 0
2624 # Diagonal => 'A032766',
2625 #
2626 # };
2627 }
2628 {
2629 package Math::PlanePath::CellularRule::Two;
2630 use constant _NumSeq_Y_axis_increasing => 1;
2631 use constant _NumSeq_Diagonal_increasing => 1;
2632 use constant _NumSeq_Diagonal_NW_increasing => 1;
2633  
2634 use constant _NumSeq_N_oeis_anum =>
2635 { 'align=right,n_start=1' =>
2636 { Diagonal => 'A005408', # odd 2n+1
2637 # OEIS-Other: A005408 planepath=CellularRule,rule=84 line_type=Diagonal
2638 },
2639 };
2640 }
2641 {
2642 package Math::PlanePath::CellularRule::OddSolid;
2643 # rule=50,58,114,122,178,179,186,242,250 pyramid every second point
2644  
2645 use constant _NumSeq_Y_axis_increasing => 1;
2646 use constant _NumSeq_Diagonal_increasing => 1;
2647 use constant _NumSeq_Diagonal_NW_increasing => 1;
2648  
2649 use constant _NumSeq_N_oeis_anum =>
2650 { 'n_start=1' =>
2651 { Diagonal_NW => 'A000124', # triangular+1
2652 # OEIS-Other: A000124 planepath=CellularRule,rule=50 line_type=Diagonal_NW
2653 # OEIS-Other: A000124 planepath=CellularRule,rule=58 line_type=Diagonal_NW
2654 # OEIS-Other: A000124 planepath=CellularRule,rule=114 line_type=Diagonal_NW
2655 # OEIS-Other: A000124 planepath=CellularRule,rule=122 line_type=Diagonal_NW
2656 # OEIS-Other: A000124 planepath=CellularRule,rule=178 line_type=Diagonal_NW
2657 # OEIS-Other: A000124 planepath=CellularRule,rule=179 line_type=Diagonal_NW
2658 # OEIS-Other: A000124 planepath=CellularRule,rule=186 line_type=Diagonal_NW
2659 # OEIS-Other: A000124 planepath=CellularRule,rule=242 line_type=Diagonal_NW
2660 # OEIS-Other: A000124 planepath=CellularRule,rule=250 line_type=Diagonal_NW
2661 #
2662 # Not quite, starts value=0
2663 # Diagonal => 'A000217', # triangular numbers but diff start
2664 },
2665 };
2666 }
2667 { package Math::PlanePath::CellularRule54;
2668 use constant _NumSeq_Y_axis_increasing => 1;
2669 use constant _NumSeq_Diagonal_increasing => 1;
2670 use constant _NumSeq_Diagonal_NW_increasing => 1;
2671 }
2672 { package Math::PlanePath::CellularRule57;
2673 use constant _NumSeq_Y_axis_increasing => 1;
2674 use constant _NumSeq_Diagonal_increasing => 1;
2675 use constant _NumSeq_Diagonal_NW_increasing => 1;
2676 }
2677 { package Math::PlanePath::CellularRule190;
2678 use constant _NumSeq_Y_axis_increasing => 1;
2679 use constant _NumSeq_Diagonal_increasing => 1;
2680 use constant _NumSeq_Diagonal_NW_increasing => 1;
2681  
2682 use constant _NumSeq_N_oeis_anum =>
2683 { 'mirror=0,n_start=0' =>
2684 { Diagonal_NW => 'A006578', # triangular and quarter square
2685 # OEIS-Catalogue: A006578 planepath=CellularRule190,n_start=0 line_type=Diagonal_NW
2686 },
2687 'mirror=1,n_start=0' =>
2688 { Diagonal_NW => 'A006578', # triangular and quarter square
2689 # OEIS-Other: A006578 planepath=CellularRule190,mirror=1,n_start=0 line_type=Diagonal_NW
2690 },
2691 };
2692 }
2693 { package Math::PlanePath::UlamWarburton;
2694 use constant _NumSeq_X_axis_increasing => 1;
2695 use constant _NumSeq_Y_axis_increasing => 1;
2696 use constant _NumSeq_X_neg_increasing => 1;
2697 use constant _NumSeq_Y_neg_increasing => 1;
2698 use constant _NumSeq_Diagonal_increasing => 1;
2699 use constant _NumSeq_Diagonal_NW_increasing => 1;
2700 use constant _NumSeq_Diagonal_SW_increasing => 1;
2701 use constant _NumSeq_Diagonal_SE_increasing => 1;
2702  
2703 use constant _NumSeq_N_oeis_anum =>
2704 { 'parts=4,n_start=0' =>
2705 { Depth_start => 'A147562', # cells ON after n stages
2706 # OEIS-Catalogue: A147562 planepath=UlamWarburton,n_start=0 line_type=Depth_start
2707 },
2708 'parts=2,n_start=0' =>
2709 { Depth_start => 'A183060', # num cells ON, starting from 0
2710 X_axis => 'A183060', # X_axis == Depth_start
2711 # OEIS-Catalogue: A183060 planepath=UlamWarburton,parts=2,n_start=0 line_type=Depth_start
2712 # OEIS-Other: A183060 planepath=UlamWarburton,parts=2,n_start=0
2713 },
2714 'parts=1,n_start=1' =>
2715 { Depth_end => 'A151922', # num cells ON at end of depth=n
2716 Y_axis => 'A151922', # Y_axis == Depth_end
2717 # OEIS-Catalogue: A151922 planepath=UlamWarburton,parts=1,n_start=1 line_type=Depth_end
2718 # OEIS-Other: A151922 planepath=UlamWarburton,parts=1,n_start=1 line_type=Y_axis
2719 },
2720 };
2721 }
2722 { package Math::PlanePath::UlamWarburtonQuarter;
2723 use constant _NumSeq_X_axis_increasing => 1;
2724 use constant _NumSeq_Diagonal_increasing => 1;
2725  
2726 # low 10111=23 increment to 11000=24
2727 # 4^2*3+4*3^2+1*3^3 = 111 123
2728 # 4^3*3 = 192 150 +27 = 3^3
2729  
2730 use constant _NumSeq_N_oeis_anum =>
2731 { 'parts=1,n_start=1' =>
2732 { Depth_end => 'A151920', # 3^count1bits(n), OFFSET=0 1,2,5,6,9
2733 # OEIS-Catalogue: A151920 planepath=UlamWarburtonQuarter line_type=Depth_end
2734 },
2735 };
2736 }
2737 { package Math::PlanePath::CoprimeColumns;
2738 use constant _NumSeq_X_axis_increasing => 1;
2739 use constant _NumSeq_Diagonal_increasing => 1;
2740 use constant _NumSeq_Diagonal_X_offset => 1;
2741  
2742 # CoprimeColumns
2743 # X_axis => 'A002088', # cumulative totient but start X=1 value=0;
2744 # Diagonal A015614 cumulative-1 but start X=1 value=1
2745 }
2746 { package Math::PlanePath::DivisibleColumns;
2747 use constant _NumSeq_X_axis_increasing => 1;
2748 use constant _NumSeq_Diagonal_increasing => 1;
2749  
2750 # Not quite, X_axis => 'A006218' but path start X=1 cf OFFSET=0,
2751 # Not quite, Diagonal => 'A077597' but path start X=1 cf OFFSET=0
2752 }
2753 # { package Math::PlanePath::File;
2754 # # File points from a disk file
2755 # # FIXME: analyze points for min/max
2756 # }
2757 # { package Math::PlanePath::QuintetCurve;
2758 # }
2759 # { package Math::PlanePath::QuintetCentres;
2760 # # inherit QuintetCurve
2761 # }
2762 { package Math::PlanePath::CornerReplicate;
2763 use constant _NumSeq_X_axis_increasing => 1;
2764 use constant _NumSeq_Y_axis_increasing => 1;
2765 use constant _NumSeq_Diagonal_increasing => 1;
2766  
2767 use constant _NumSeq_N_oeis_anum =>
2768 { '' =>
2769 { X_axis => 'A000695', # base 4 digits 0,1 only
2770 Y_axis => 'A001196', # base 4 digits 0,3 only
2771 Diagonal => 'A062880', # base 4 digits 0,2 only
2772 # OEIS-Other: A000695 planepath=CornerReplicate
2773 # OEIS-Other: A001196 planepath=CornerReplicate line_type=Y_axis
2774 # OEIS-Other: A062880 planepath=CornerReplicate line_type=Diagonal
2775 },
2776 };
2777 }
2778 { package Math::PlanePath::DigitGroups;
2779 use constant _NumSeq_Diagonal_increasing => 1;
2780  
2781 use constant _NumSeq_N_oeis_anum =>
2782 { 'radix=2,i_start=1' =>
2783 { X_axis => 'A084471', # 0 -> 00 in binary, starting OFFSET=1
2784 # OEIS-Catalogue: A084471 planepath=DigitGroups,radix=2 i_start=1
2785 },
2786 };
2787 }
2788 { package Math::PlanePath::FibonacciWordFractal;
2789 use constant _NumSeq_X_axis_increasing => 1; # when touched
2790 use constant _NumSeq_Y_axis_increasing => 1; # when touched
2791 use constant _NumSeq_Diagonal_increasing => 1; # when touched
2792 }
2793 { package Math::PlanePath::LTiling;
2794 use constant _NumSeq_Diagonal_increasing => 1;
2795  
2796 use constant _NumSeq_N_oeis_anum =>
2797 { 'L_fill=middle' =>
2798 { Diagonal => 'A062880', # base 4 digits 0,2 only
2799 # OEIS-Other: A062880 planepath=LTiling line_type=Diagonal
2800 },
2801 };
2802 }
2803 { package Math::PlanePath::WythoffArray;
2804 use constant _NumSeq_X_axis_increasing => 1;
2805 use constant _NumSeq_Y_axis_increasing => 1;
2806 use constant _NumSeq_Diagonal_increasing => 1;
2807  
2808 use constant _NumSeq_N_oeis_anum =>
2809 {
2810 'x_start=1,y_start=1' =>
2811 { Y_axis => 'A003622', # spectrum of phi 1,4,6,9
2812 Diagonal => 'A020941', # diagonal, OFFSET=1
2813 # OEIS-Catalogue: A003622 planepath=WythoffArray,x_start=1,y_start=1 line_type=Y_axis
2814 # OEIS-Catalogue: A020941 planepath=WythoffArray,x_start=1,y_start=1 line_type=Diagonal
2815  
2816 # Y=1 every second => 'A005248', # every second Lucas number
2817 },
2818  
2819 # # Not quite, extra initial 0,1 in A000045 Fibonaccis
2820 # # X_axis => 'A000045',
2821 #
2822 # # Y=1 row X=0,2,4,etc => 'A005248', # every second Lucas number
2823 };
2824 }
2825 { package Math::PlanePath::WythoffPreliminaryTriangle;
2826 use constant _NumSeq_Y_axis_i_start => 1;
2827 use constant _NumSeq_Y_axis_increasing => 1;
2828 use constant _NumSeq_N_oeis_anum =>
2829 {
2830 '' =>
2831 { Y_axis => 'A173027',
2832 # OEIS-Other: A173027 planepath=WythoffPreliminaryTriangle line_type=Y_axis
2833 },
2834 };
2835 }
2836 { package Math::PlanePath::PowerArray;
2837 use constant _NumSeq_X_axis_increasing => 1;
2838 use constant _NumSeq_Y_axis_increasing => 1;
2839 use constant _NumSeq_Diagonal_increasing => 1;
2840  
2841 # cf Not quite A168183 non-multiples-of-9, A168186 non-multiples-of-12
2842 # are values on Y axis, except OFFSET=1 value=1, whereas path start Y=0
2843 # value=1
2844 use constant _NumSeq_N_oeis_anum =>
2845 { 'radix=2' =>
2846 { X_axis => 'A000079', # powers 2^X
2847 Y_axis => 'A005408', # odd 2n+1
2848 Diagonal => 'A014480', # (2n+1)*2^n starting n=0
2849 # OEIS-Other: A000079 planepath=PowerArray
2850 # OEIS-Other: A005408 planepath=PowerArray line_type=Y_axis
2851 # OEIS-Catalogue: A014480 planepath=PowerArray line_type=Diagonal
2852 },
2853 'radix=3' =>
2854 { X_axis => 'A000244', # powers 3^X
2855 # OEIS-Other: A000244 planepath=PowerArray,radix=3
2856 #
2857 # Not quite, OFFSET=1 cf path start Y=0
2858 # Y_axis => 'A001651', # non multiples of 3
2859 },
2860 'radix=4' =>
2861 { X_axis => 'A000302', # powers 4^X
2862 # OEIS-Other: A000302 planepath=PowerArray,radix=4
2863 },
2864 'radix=5' =>
2865 { X_axis => 'A000351', # powers 5^X
2866 # OEIS-Other: A000351 planepath=PowerArray,radix=5
2867 },
2868 'radix=10' =>
2869 { X_axis => 'A011557', # powers 10^X
2870 # OEIS-Other: A011557 planepath=PowerArray,radix=10
2871  
2872 # Not quite, A067251 OFFSET=1 value=1 whereas path Y=0 N=value=1
2873 # Y_axis => 'A067251', # no trailing 0 digits
2874 # # OEIS-Catalogue: A067251 planepath=PowerArray,radix=10 line_type=Y_axis
2875 },
2876 };
2877 }
2878  
2879 #------------------------------------------------------------------------------
2880 # Math-PlanePath-Toothpick
2881  
2882 { package Math::PlanePath::ToothpickTree;
2883  
2884 # X axis has N=0 or N=0,1 only, except for parts=octant axis at Y=1
2885 sub _NumSeq_X_axis_increasing {
2886 my ($self) = @_;
2887 return ($self->{'parts'} ne 'octant');
2888 }
2889  
2890 # Y axis has N=0,N=1 only, except for parts=octant_up axis at X=1
2891 sub _NumSeq_Y_axis_increasing {
2892 my ($self) = @_;
2893 return ($self->{'parts'} ne 'octant_up');
2894 }
2895 use constant _NumSeq_Y_neg_increasing => 1; # N=0,N=2 only
2896  
2897 use constant _NumSeq_Diagonal_increasing => 1; # growth steps along diags
2898 use constant _NumSeq_Diagonal_NW_increasing => 1;
2899 use constant _NumSeq_Diagonal_SE_increasing => 1;
2900 use constant _NumSeq_Diagonal_SW_increasing => 1;
2901  
2902 # catalogued in Math::NumSeq::OEIS::Catalogue::Plugin::PlanePathToothpick
2903 use constant _NumSeq_N_oeis_anum =>
2904 { 'parts=4' =>
2905 { Depth_start => 'A139250',
2906 # OEIS-Other: A139250 planepath=ToothpickTree,parts=4 line_type=Depth_start
2907 },
2908 'parts=3' =>
2909 { Depth_start => 'A153006',
2910 # OEIS-Other: A153006 planepath=ToothpickTree,parts=3 line_type=Depth_start
2911 },
2912 'parts=2' =>
2913 { Depth_start => 'A152998',
2914 # OEIS-Other: A152998 planepath=ToothpickTree,parts=2 line_type=Depth_start
2915 },
2916 'parts=1' =>
2917 { Depth_start => 'A153000',
2918 # OEIS-Other: A153000 planepath=ToothpickTree,parts=1 line_type=Depth_start
2919 },
2920 'parts=wedge' =>
2921 { Depth_start => 'A160406',
2922 # OEIS-Other: A160406 planepath=ToothpickTree,parts=wedge line_type=Depth_start
2923 },
2924 'parts=two_horiz' =>
2925 { Depth_start => 'A160158',
2926 # OEIS-Other: A160158 planepath=ToothpickTree,parts=two_horiz line_type=Depth_start
2927 },
2928 };
2929 }
2930 { package Math::PlanePath::ToothpickReplicate;
2931 use constant _NumSeq_Y_axis_increasing => 1; # N=0,N=1 only
2932  
2933 sub _NumSeq_Y_neg_increasing {
2934 my ($self) = @_;
2935 return ($self->{'parts'} == 3 ? 0 # replication twist
2936 : 1); # N=0,N=2 only
2937 }
2938 use constant _NumSeq_Diagonal_increasing => 1; # replicate along diags
2939 use constant _NumSeq_Diagonal_NW_increasing => 1;
2940 use constant _NumSeq_Diagonal_SE_increasing => 1;
2941 use constant _NumSeq_Diagonal_SW_increasing => 1;
2942 }
2943 { package Math::PlanePath::ToothpickUpist;
2944 use constant _NumSeq_Y_axis_increasing => 1; # rows increasing
2945 use constant _NumSeq_Diagonal_increasing => 1;
2946 use constant _NumSeq_Diagonal_NW_increasing => 1;
2947  
2948 # catalogued in Math::NumSeq::OEIS::Catalogue::Plugin::PlanePathToothpick
2949 use constant _NumSeq_N_oeis_anum =>
2950 { '' =>
2951 { Depth_start => 'A151566',
2952 # OEIS-Other: A151566 planepath=ToothpickUpist line_type=Depth_start
2953 },
2954 };
2955 }
2956 { package Math::PlanePath::ToothpickSpiral;
2957 use constant _NumSeq_X_axis_increasing => 1;
2958 use constant _NumSeq_Y_axis_increasing => 1;
2959 use constant _NumSeq_X_neg_increasing => 1;
2960 use constant _NumSeq_Diagonal_increasing => 1;
2961 use constant _NumSeq_Diagonal_NW_increasing => 1;
2962 use constant _NumSeq_Diagonal_SW_increasing => 1;
2963 use constant _NumSeq_Diagonal_SE_increasing => 1;
2964  
2965 # catalogued in Math::NumSeq::OEIS::Catalogue::Plugin::PlanePathToothpick
2966 use constant _NumSeq_N_oeis_anum =>
2967 { 'n_start=1' =>
2968 { Diagonal => 'A014634', # odd-index hexagonals
2969 Diagonal_NW => 'A033567', #
2970 Diagonal_SW => 'A185438', #
2971 Diagonal_SE => 'A188135', #
2972 # OEIS-Other: A014634 planepath=ToothpickSpiral line_type=Diagonal
2973 # OEIS-Other: A033567 planepath=ToothpickSpiral line_type=Diagonal_NW
2974 # OEIS-Other: A185438 planepath=ToothpickSpiral line_type=Diagonal_SW
2975 # OEIS-Other: A188135 planepath=ToothpickSpiral line_type=Diagonal_SE
2976 },
2977 'n_start=0' =>
2978 { Diagonal => 'A033587', #
2979 Diagonal_SW => 'A014635', # even-index hexagonals
2980 Diagonal_SE => 'A033585', #
2981 # OEIS-Other: A033587 planepath=ToothpickSpiral,n_start=0 line_type=Diagonal
2982 # OEIS-Other: A014635 planepath=ToothpickSpiral,n_start=0 line_type=Diagonal_SW
2983 # OEIS-Other: A033585 planepath=ToothpickSpiral,n_start=0 line_type=Diagonal_SE
2984 },
2985 };
2986 }
2987  
2988 { package Math::PlanePath::LCornerTree;
2989 sub _NumSeq_X_axis_increasing {
2990 my ($self) = @_;
2991 return $self->{'parts'} ne 'diagonal-1';
2992 }
2993  
2994 {
2995 my %_NumSeq_Y_axis_increasing = ('octant+1' => 1, # two points only
2996 'diagonal-1' => 1,
2997 );
2998 sub _NumSeq_Y_axis_increasing {
2999 my ($self) = @_;
3000 return $_NumSeq_Y_axis_increasing{$self->{'parts'}};
3001 }
3002 }
3003  
3004 sub _NumSeq_X_neg_increasing {
3005 my ($self) = @_;
3006 return ($self->{'parts'} eq 'wedge' # two points N=0,N=1
3007 || $self->{'parts'} eq 'wedge+1' # three points N=0,1,7
3008 || $self->{'parts'} eq 'diagonal');
3009 }
3010  
3011 # parts=diagonal has minimum N=0 at X=0,Y=-1, so explicit Y_neg minimum
3012 use constant _NumSeq_Y_neg_min => 0;
3013 sub _NumSeq_Y_neg_increasing {
3014 my ($self) = @_;
3015 return $self->{'parts'} ne 'diagonal';
3016 }
3017 use constant _NumSeq_Diagonal_increasing => 1; # growth along diags
3018 use constant _NumSeq_Diagonal_NW_increasing => 1;
3019 use constant _NumSeq_Diagonal_SE_increasing => 1;
3020 use constant _NumSeq_Diagonal_SW_increasing => 1;
3021  
3022 # catalogued in Math::NumSeq::OEIS::Catalogue::Plugin::PlanePathToothpick
3023 use constant _NumSeq_N_oeis_anum =>
3024 { 'parts=4' =>
3025 { Depth_start => 'A160410', # 4 * cumulative 3^count1bits(n)
3026 # OEIS-Other: A160410 planepath=LCornerTree line_type=Depth_start
3027 },
3028 'parts=3' =>
3029 { Depth_start => 'A160412', # 3 * cumulative 3^count1bits(n)
3030 # OEIS-Other: A160412 planepath=LCornerTree,parts=3 line_type=Depth_start
3031 },
3032 'parts=diagonal-1' =>
3033 { Depth_start => 'A183148', # half-plane triplet toothpicks
3034 # OEIS-Other: A183148 planepath=LCornerTree,parts=diagonal-1 line_type=Depth_start
3035  
3036 # No, N=1 start of depth=1 is at X=1,Y=0 not on SE diagonal
3037 # Diagonal_SE => 'A183148',
3038 },
3039  
3040 # Not quite, A130665=1,4,7,16 offset=0 whereas Nend=0,1,4,7,16 depth=0
3041 # has extra initial 0.
3042 # 'parts=1' =>
3043 # { Depth_end => 'A130665', # cumulative 3^count1bits(d), starting a(0)=1
3044 # # OEIS-Catalogue: A130665 planepath=LCornerTree,parts=1,n_start=-1 line_type=Depth_end i_offset=1
3045 # },
3046 };
3047 }
3048 { package Math::PlanePath::LCornerReplicate;
3049 use constant _NumSeq_X_axis_increasing => 1;
3050 use constant _NumSeq_Diagonal_increasing => 1; # replicate along diags
3051  
3052 # catalogued in Math::NumSeq::OEIS::Catalogue::Plugin::PlanePathToothpick
3053 use constant _NumSeq_N_oeis_anum =>
3054 { '' =>
3055 { Diagonal => 'A062880', # base 4 digits 0,2 only
3056 # OEIS-Other: A062880 planepath=LCornerReplicate line_type=Diagonal
3057 },
3058 };
3059 }
3060  
3061 { package Math::PlanePath::OneOfEight;
3062 use constant _NumSeq_X_axis_increasing => 1;
3063 use constant _NumSeq_X_neg_increasing => 1;
3064 use constant _NumSeq_Y_axis_increasing => 1;
3065 use constant _NumSeq_Y_neg_increasing => 1;
3066 use constant _NumSeq_Diagonal_increasing => 1;
3067 use constant _NumSeq_Diagonal_NW_increasing => 1;
3068 use constant _NumSeq_Diagonal_SW_increasing => 1;
3069 use constant _NumSeq_Diagonal_SE_increasing => 1;
3070  
3071 # catalogued in Math::NumSeq::OEIS::Catalogue::Plugin::PlanePathToothpick
3072 use constant _NumSeq_N_oeis_anum =>
3073 { 'parts=4' =>
3074 { Depth_start => 'A151725',
3075 # OEIS-Other: A151725 planepath=OneOfEight line_type=Depth_start
3076 },
3077 'parts=1' =>
3078 { Depth_start => 'A151735',
3079 # OEIS-Other: A151735 planepath=OneOfEight,parts=1 line_type=Depth_start
3080 },
3081 'parts=3mid' =>
3082 { Depth_start => 'A170880',
3083 # OEIS-Other: A170880 planepath=OneOfEight,parts=3mid line_type=Depth_start
3084 },
3085 'parts=3side' =>
3086 { Depth_start => 'A170879',
3087 # OEIS-Other: A170879 planepath=OneOfEight,parts=3side line_type=Depth_start
3088 },
3089 };
3090 }
3091  
3092 { package Math::PlanePath::HTree;
3093 # clockwise around each sub-tree so N increases along X axis
3094 use constant _NumSeq_X_axis_increasing => 1;
3095 }
3096  
3097 #------------------------------------------------------------------------------
3098 { package Math::PlanePath;
3099 use constant _NumSeq_A2 => 0;
3100 }
3101 { package Math::PlanePath::TriangleSpiral;
3102 use constant _NumSeq_A2 => 1;
3103 }
3104 { package Math::PlanePath::HexSpiral;
3105 use constant _NumSeq_A2 => 1;
3106 }
3107 { package Math::PlanePath::HexArms;
3108 use constant _NumSeq_A2 => 1;
3109 }
3110 { package Math::PlanePath::TriangularHypot;
3111 use constant _NumSeq_A2 => 1;
3112 }
3113 { package Math::PlanePath::Flowsnake;
3114 use constant _NumSeq_A2 => 1;
3115 # and FlowsnakeCentres inherits
3116 }
3117  
3118 1;
3119 __END__