NumSeq/PlanePathN.pm untested

filter: Statementstmt 0.0% 0 / 2122 Branchbran 0.0% 0 / 66 Conditioncond 0.0% 0 / 117 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 625 Podpod 0.0% 0 / 75 totaltotal 0.0% 0 / 3005 CC 34 SCAR 10.0
CC
34
Cov
0%
oeis_anum
30.0
_NumSeq_Diagonal_increasing
20.0
new
12.0
CRAP 2.7
1 # Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 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 = 128;
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; # not A2 grid, but X axis steps by 2
776 use constant _NumSeq_X_neg_step => 2;
777 use constant _NumSeq_X_axis_increasing => 1;
778 use constant _NumSeq_Y_axis_increasing => 1;
779 use constant _NumSeq_X_neg_increasing => 1;
780 use constant _NumSeq_Y_neg_increasing => 1;
781 use constant _NumSeq_Diagonal_increasing => 1;
782 use constant _NumSeq_Diagonal_NW_increasing => 1;
783 use constant _NumSeq_Diagonal_SW_increasing => 1;
784 use constant _NumSeq_Diagonal_SE_increasing => 1;
785  
786 use constant _NumSeq_N_oeis_anum =>
787 { 'n_start=1' =>
788 { X_axis => 'A192136', # (5*n^2-3*n+2)/2
789 X_neg => 'A116668', # (5n^2 + n + 2)/2
790 Diagonal_SE => 'A005891', # centred pentagonal (5n^2+5n+2)/2
791 # OEIS-Other: A192136 planepath=PentSpiral
792 # OEIS-Other: A116668 planepath=PentSpiral line_type=X_neg
793 # OEIS-Other: A005891 planepath=PentSpiral line_type=Diagonal_SE
794  
795 # Not quite, A134238 OFFSET=1 vs start X=0 here
796 # Diagonal_SW => 'A134238',
797 },
798  
799 'n_start=0' =>
800 { X_axis => 'A000566', # heptagonals
801 Y_axis => 'A005476',
802 Diagonal_SE => 'A028895', # 5*triangular
803 # OEIS-Other: A000566 planepath=PentSpiral,n_start=0
804 # OEIS-Other: A005476 planepath=PentSpiral,n_start=0 line_type=Y_axis
805 # OEIS-Other: A028895 planepath=PentSpiral,n_start=0 line_type=Diagonal_SE
806 },
807 };
808 }
809 { package Math::PlanePath::PentSpiralSkewed;
810 use constant _NumSeq_X_axis_increasing => 1;
811 use constant _NumSeq_Y_axis_increasing => 1;
812 use constant _NumSeq_X_neg_increasing => 1;
813 use constant _NumSeq_Y_neg_increasing => 1;
814 use constant _NumSeq_Diagonal_increasing => 1;
815 use constant _NumSeq_Diagonal_NW_increasing => 1;
816 use constant _NumSeq_Diagonal_SW_increasing => 1;
817 use constant _NumSeq_Diagonal_SE_increasing => 1;
818  
819 use constant _NumSeq_N_oeis_anum =>
820 { 'n_start=1' =>
821 { X_axis => 'A192136', # (5*n^2-3*n+2)/2
822 X_neg => 'A116668', # (5n^2 + n + 2)/2
823 Diagonal_NW => 'A158187', # 10*n^2 + 1
824 Diagonal_SE => 'A005891', # centred pentagonal (5n^2+5n+2)/2
825 # OEIS-Catalogue: A192136 planepath=PentSpiralSkewed
826 # OEIS-Catalogue: A116668 planepath=PentSpiralSkewed line_type=X_neg
827 # OEIS-Catalogue: A158187 planepath=PentSpiralSkewed line_type=Diagonal_NW
828 # OEIS-Catalogue: A005891 planepath=PentSpiralSkewed line_type=Diagonal_SE
829  
830 # Not quite, A140066 OFFSET=1 but path start Y=0 here
831 # Y_axis => 'A140066', # (5n^2-11n+8)/2 but from Y=0 so using (n-1)
832  
833 # Not quite, A134238 OFFSET=1 but path start Y=0 here
834 # Y_neg => 'A134238',
835 # # OEIS-Catalogue: A134238 planepath=PentSpiralSkewed line_type=Y_neg
836 },
837  
838 'n_start=0' =>
839 { X_axis => 'A000566', # heptagonals
840 Y_axis => 'A005476',
841 X_neg => 'A005475',
842 Diagonal_NW => 'A033583', # 10*n^2
843 Diagonal_SE => 'A028895', # 5*triangular
844 # OEIS-Other: A000566 planepath=PentSpiralSkewed,n_start=0
845 # OEIS-Catalogue: A005476 planepath=PentSpiralSkewed,n_start=0 line_type=Y_axis
846 # OEIS-Catalogue: A005475 planepath=PentSpiralSkewed,n_start=0 line_type=X_neg
847 # OEIS-Other: A033583 planepath=PentSpiralSkewed,n_start=0 line_type=Diagonal_NW
848 # OEIS-Catalogue: A028895 planepath=PentSpiralSkewed,n_start=0 line_type=Diagonal_SE
849  
850 # Not quite, A147875 OFFSET=1 vs start Y=0 here
851 # Y_neg => 'A147875', # second heptagonals
852 # # OEIS-Other: A147875 planepath=PentSpiralSkewed,n_start=0 line_type=Y_neg
853 },
854 };
855 }
856 { package Math::PlanePath::HexSpiral;
857 use constant _NumSeq_X_axis_increasing => 1;
858 use constant _NumSeq_Y_axis_increasing => 1;
859 *_NumSeq_X_neg_increasing
860 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_increasing;
861 *_NumSeq_X_neg_increasing_from_i
862 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_increasing_from_i;
863 *_NumSeq_X_neg_min
864 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_min;
865 use constant _NumSeq_Y_neg_increasing => 1;
866 use constant _NumSeq_Diagonal_increasing => 1;
867 use constant _NumSeq_Diagonal_NW_increasing => 1;
868 use constant _NumSeq_Diagonal_SW_increasing => 1;
869 use constant _NumSeq_Diagonal_SE_increasing => 1;
870  
871 use constant _NumSeq_N_oeis_anum =>
872 { 'wider=0,n_start=1' =>
873 { X_axis => 'A056105', # first spoke 3n^2-2n+1
874 Diagonal => 'A056106', # second spoke 3n^2-n+1
875 Diagonal_NW => 'A056107', # third spoke 3n^2+1
876 X_neg => 'A056108', # fourth spoke 3n^2+n+1
877 Diagonal_SW => 'A056109', # fifth spoke 3n^2+2n+1
878 Diagonal_SE => 'A003215', # centred hexagonal numbers
879 # OEIS-Other: A056105 planepath=HexSpiral
880 # OEIS-Other: A056106 planepath=HexSpiral line_type=Diagonal
881 # OEIS-Other: A056107 planepath=HexSpiral line_type=Diagonal_NW
882 # OEIS-Other: A056108 planepath=HexSpiral line_type=X_neg
883 # OEIS-Other: A056109 planepath=HexSpiral line_type=Diagonal_SW
884 # OEIS-Other: A003215 planepath=HexSpiral line_type=Diagonal_SE
885 },
886 'wider=0,n_start=0' =>
887 { X_axis => 'A000567', # octagonal numbers
888 X_neg => 'A049451',
889 Diagonal => 'A049450',
890 Diagonal_NW => 'A033428', # octagonal numbers first,second average
891 Diagonal_SW => 'A045944', # octagonal numbers second
892 Diagonal_SE => 'A028896',
893 # OEIS-Other: A000567 planepath=HexSpiral,n_start=0
894 # OEIS-Other: A049451 planepath=HexSpiral,n_start=0 line_type=X_neg
895 # OEIS-Catalogue: A049450 planepath=HexSpiral,n_start=0 line_type=Diagonal
896 # OEIS-Other: A033428 planepath=HexSpiral,n_start=0 line_type=Diagonal_NW
897 # OEIS-Other: A045944 planepath=HexSpiral,n_start=0 line_type=Diagonal_SW
898 # OEIS-Catalogue: A028896 planepath=HexSpiral,n_start=0 line_type=Diagonal_SE
899 },
900 };
901 }
902 { package Math::PlanePath::HexSpiralSkewed;
903 use constant _NumSeq_X_axis_increasing => 1;
904 use constant _NumSeq_Y_axis_increasing => 1;
905 *_NumSeq_X_neg_increasing
906 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_increasing;
907 *_NumSeq_X_neg_increasing_from_i
908 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_increasing_from_i;
909 *_NumSeq_X_neg_min
910 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_min;
911 use constant _NumSeq_Y_neg_increasing => 1;
912 use constant _NumSeq_Diagonal_increasing => 1;
913 use constant _NumSeq_Diagonal_NW_increasing => 1;
914 use constant _NumSeq_Diagonal_SW_increasing => 1;
915 use constant _NumSeq_Diagonal_SE_increasing => 1;
916  
917 use constant _NumSeq_N_oeis_anum =>
918 { 'wider=0,n_start=1' =>
919 { X_axis => 'A056105', # first spoke 3n^2-2n+1
920 Y_axis => 'A056106', # second spoke 3n^2-n+1
921 Diagonal_NW => 'A056107', # third spoke 3n^2+1
922 X_neg => 'A056108', # fourth spoke 3n^2+n+1
923 Y_neg => 'A056109', # fifth spoke 3n^2+2n+1
924 Diagonal_SE => 'A003215', # centred hexagonal numbers
925 # OEIS-Catalogue: A056105 planepath=HexSpiralSkewed
926 # OEIS-Catalogue: A056106 planepath=HexSpiralSkewed line_type=Y_axis
927 # OEIS-Catalogue: A056108 planepath=HexSpiralSkewed line_type=X_neg
928 # OEIS-Catalogue: A056109 planepath=HexSpiralSkewed line_type=Y_neg
929 # OEIS-Catalogue: A056107 planepath=HexSpiralSkewed line_type=Diagonal_NW
930 # OEIS-Other: A003215 planepath=HexSpiralSkewed line_type=Diagonal_SE
931 },
932 'wider=0,n_start=0' =>
933 { X_axis => 'A000567', # octagonal numbers
934 Y_axis => 'A049450',
935 X_neg => 'A049451',
936 Y_neg => 'A045944', # octagonal numbers second
937 Diagonal => 'A062783',
938 Diagonal_NW => 'A033428', # octagonal numbers first,second average
939 Diagonal_SW => 'A063436',
940 Diagonal_SE => 'A028896',
941 # OEIS-Other: A000567 planepath=HexSpiralSkewed,n_start=0
942 # OEIS-Other: A049450 planepath=HexSpiralSkewed,n_start=0 line_type=Y_axis
943 # OEIS-Catalogue: A049451 planepath=HexSpiralSkewed,n_start=0 line_type=X_neg
944 # OEIS-Other: A045944 planepath=HexSpiralSkewed,n_start=0 line_type=Y_neg
945 # OEIS-Catalogue: A062783 planepath=HexSpiralSkewed,n_start=0 line_type=Diagonal
946 # OEIS-Other: A033428 planepath=HexSpiralSkewed,n_start=0 line_type=Diagonal_NW
947 # OEIS-Catalogue: A063436 planepath=HexSpiralSkewed,n_start=0 line_type=Diagonal_SW
948 # OEIS-Other: A028896 planepath=HexSpiralSkewed,n_start=0 line_type=Diagonal_SE
949 },
950  
951 # wider=1 X_axis almost 3*n^2 but not initial X=0 value
952 # wider=1 Y_axis almost A049451 twice pentagonal but not initial X=0
953 # wider=2 Y_axis almost A028896 6*triangular but not initial Y=0
954 };
955 }
956 { package Math::PlanePath::HexArms;
957 use constant _NumSeq_X_axis_increasing => 1;
958 use constant _NumSeq_Y_axis_increasing => 1;
959 use constant _NumSeq_X_neg_increasing => 1;
960 use constant _NumSeq_Y_neg_increasing => 1;
961 use constant _NumSeq_Diagonal_increasing => 1;
962 use constant _NumSeq_Diagonal_NW_increasing => 1;
963 use constant _NumSeq_Diagonal_SW_increasing => 1;
964 use constant _NumSeq_Diagonal_SE_increasing => 1;
965 }
966 { package Math::PlanePath::HeptSpiralSkewed;
967 use constant _NumSeq_X_axis_increasing => 1;
968 use constant _NumSeq_Y_axis_increasing => 1;
969 use constant _NumSeq_X_neg_increasing => 1;
970 use constant _NumSeq_Y_neg_increasing => 1;
971 use constant _NumSeq_Diagonal_increasing => 1;
972 use constant _NumSeq_Diagonal_NW_increasing => 1;
973 use constant _NumSeq_Diagonal_SW_increasing => 1;
974 use constant _NumSeq_Diagonal_SE_increasing => 1;
975  
976 use constant _NumSeq_N_oeis_anum =>
977 {
978 # 'n_start=1' =>
979 # {
980 # # Not quite, OFFSET=1 vs path start X=Y=0
981 # # Y_axis => 'A140065', # (7n^2 - 17n + 12)/2 but starting Y=0 not n=1
982 # # Diagonal_NW => 'A140063',
983 # # Diagonal_SE => 'A069099',
984 # },
985  
986 'n_start=0' =>
987 { X_axis => 'A001106', # 9-gonals
988 Y_axis => 'A218471',
989 X_neg => 'A022265',
990 Y_neg => 'A179986', # second 9-gonals
991 Diagonal => 'A195023',
992 Diagonal_NW => 'A022264',
993 Diagonal_SW => 'A186029',
994 Diagonal_SE => 'A024966',
995 # OEIS-Other: A001106 planepath=HeptSpiralSkewed,n_start=0
996 # OEIS-Catalogue: A022265 planepath=HeptSpiralSkewed,n_start=0 line_type=X_neg
997 # OEIS-Catalogue: A218471 planepath=HeptSpiralSkewed,n_start=0 line_type=Y_axis
998 # OEIS-Other: A179986 planepath=HeptSpiralSkewed,n_start=0 line_type=Y_neg
999 # OEIS-Catalogue: A195023 planepath=HeptSpiralSkewed,n_start=0 line_type=Diagonal
1000 # OEIS-Catalogue: A022264 planepath=HeptSpiralSkewed,n_start=0 line_type=Diagonal_NW
1001 # OEIS-Catalogue: A186029 planepath=HeptSpiralSkewed,n_start=0 line_type=Diagonal_SW
1002 # OEIS-Catalogue: A024966 planepath=HeptSpiralSkewed,n_start=0 line_type=Diagonal_SE
1003 },
1004 };
1005 }
1006 { package Math::PlanePath::OctagramSpiral;
1007 use constant _NumSeq_X_axis_increasing => 1;
1008 use constant _NumSeq_Y_axis_increasing => 1;
1009 use constant _NumSeq_X_neg_increasing => 1;
1010 use constant _NumSeq_Y_neg_increasing => 1;
1011 use constant _NumSeq_Diagonal_increasing => 1;
1012 use constant _NumSeq_Diagonal_NW_increasing => 1;
1013 use constant _NumSeq_Diagonal_SW_increasing => 1;
1014 use constant _NumSeq_Diagonal_SE_increasing => 1;
1015  
1016 use constant _NumSeq_N_oeis_anum =>
1017 {
1018 'n_start=1' =>
1019 { Diagonal_SE => 'A194268',
1020 # OEIS-Other: A194268 planepath=OctagramSpiral line_type=Diagonal_SE
1021  
1022 # Not quite, but A125201 doesn't have initial N=1 for path origin
1023 # X_axis => 'A125201'
1024 },
1025  
1026 'n_start=0' =>
1027 { X_axis => 'A051870', # 18-gonals
1028 Y_axis => 'A139273',
1029 X_neg => 'A139275',
1030 Y_neg => 'A139277',
1031 Diagonal => 'A139272',
1032 Diagonal_NW => 'A139274',
1033 Diagonal_SW => 'A139276',
1034 Diagonal_SE => 'A139278', # second 18-gonals
1035 # OEIS-Other: A051870 planepath=OctagramSpiral,n_start=0
1036 # OEIS-Catalogue: A139273 planepath=OctagramSpiral,n_start=0 line_type=Y_axis
1037 # OEIS-Catalogue: A139275 planepath=OctagramSpiral,n_start=0 line_type=X_neg
1038 # OEIS-Catalogue: A139277 planepath=OctagramSpiral,n_start=0 line_type=Y_neg
1039 # OEIS-Catalogue: A139272 planepath=OctagramSpiral,n_start=0 line_type=Diagonal
1040 # OEIS-Catalogue: A139274 planepath=OctagramSpiral,n_start=0 line_type=Diagonal_NW
1041 # OEIS-Catalogue: A139276 planepath=OctagramSpiral,n_start=0 line_type=Diagonal_SW
1042 # OEIS-Other: A139278 planepath=OctagramSpiral,n_start=0 line_type=Diagonal_SE
1043 },
1044 };
1045 }
1046 { package Math::PlanePath::AnvilSpiral;
1047 use constant _NumSeq_X_axis_increasing => 1;
1048 use constant _NumSeq_Y_axis_increasing => 1;
1049 *_NumSeq_X_neg_increasing
1050 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_increasing;
1051 *_NumSeq_X_neg_increasing_from_i
1052 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_increasing_from_i;
1053 *_NumSeq_X_neg_min
1054 = \&Math::PlanePath::SquareSpiral::_NumSeq_X_neg_min;
1055 use constant _NumSeq_Y_neg_increasing => 1;
1056 use constant _NumSeq_Diagonal_increasing => 1;
1057 use constant _NumSeq_Diagonal_NW_increasing => 1;
1058 use constant _NumSeq_Diagonal_SW_increasing => 1;
1059 use constant _NumSeq_Diagonal_SE_increasing => 1;
1060  
1061 use constant _NumSeq_N_oeis_anum =>
1062 { 'wider=0,n_start=1' =>
1063 { X_axis => 'A033570', # odd pentagonals (2n+1)*(3n+1)
1064 Diagonal => 'A033568', # odd second pentagonals
1065 Diagonal_SE => 'A085473',
1066 # OEIS-Catalogue: A033570 planepath=AnvilSpiral
1067 # OEIS-Catalogue: A033568 planepath=AnvilSpiral line_type=Diagonal
1068 # OEIS-Catalogue: A085473 planepath=AnvilSpiral line_type=Diagonal_SE
1069  
1070 # Not quite, A136392 OFFSET=1 value=1 whereas path start Y=0 value=1
1071 # Y_neg => 'A136392', # 1,9,29,61, 6n^2-10n+5
1072 },
1073 'wider=0,n_start=1,i_start=1' =>
1074 { Y_axis => 'A126587', # points within 3,4,5 triangle, starting value=3
1075 # OEIS-Catalogue: A126587 planepath=AnvilSpiral line_type=Y_axis i_start=1
1076 },
1077  
1078 'wider=0,n_start=0' =>
1079 { X_axis => 'A211014', # 14-gonal second
1080 Y_axis => 'A139267', # 2*octagonal
1081 X_neg => 'A049452', # alternate pentagonals
1082 Y_neg => 'A033580', # 4*second pentagonals
1083 Diagonal => 'A051866', # 14-gonals
1084 Diagonal_NW => 'A094159', # 3*hexagonal
1085 Diagonal_SW => 'A049453',
1086 Diagonal_SE => 'A195319', # 3*second hexagonal
1087 # OEIS-Other: A211014 planepath=AnvilSpiral,n_start=0
1088 # OEIS-Other: A051866 planepath=AnvilSpiral,n_start=0 line_type=Diagonal
1089 # OEIS-Catalogue: A139267 planepath=AnvilSpiral,n_start=0 line_type=Y_axis
1090 # OEIS-Catalogue: A049452 planepath=AnvilSpiral,n_start=0 line_type=X_neg
1091 # OEIS-Catalogue: A033580 planepath=AnvilSpiral,n_start=0 line_type=Y_neg
1092 # OEIS-Catalogue: A094159 planepath=AnvilSpiral,n_start=0 line_type=Diagonal_NW
1093 # OEIS-Catalogue: A049453 planepath=AnvilSpiral,n_start=0 line_type=Diagonal_SW
1094 # OEIS-Catalogue: A195319 planepath=AnvilSpiral,n_start=0 line_type=Diagonal_SE
1095 },
1096  
1097 # Not quite, A051866 starts value=0 which is at X=-1
1098 # 'wider=1,n_start=0' =>
1099 # { X_axis => 'A051866',
1100 # # OEIS-Other: A051866 planepath=AnvilSpiral,wider=1,n_start=0
1101 # },
1102 # 'wider=1,n_start=0' =>
1103 # { Diagonal_NW_minus_1 => 'A033569', # (2*n-1)*(3*n+1) starting -1
1104 # # XX-Other: A033569 planepath=AnvilSpiral,wider=1,n_start=-1 line_type=Diagonal_NW
1105 # },
1106  
1107 # 'wider=2,n_start=1' =>
1108 # {
1109 # Not quite, A033581 initial value=2 whereas path start N=0
1110 # # Y_axis => 'A033581', # 6*n^2 is 14-gonals pairs average in Math::NumSeq::Polygonal
1111 # # # OEIS-Other: A033581 planepath=AnvilSpiral,wider=2 line_type=Y_axis
1112 # },
1113 };
1114 }
1115 { package Math::PlanePath::KnightSpiral;
1116 use constant _NumSeq_Diagonal_increasing => 1; # low then high
1117 use constant _NumSeq_Diagonal_NW_increasing => 1;
1118 use constant _NumSeq_Diagonal_SW_increasing => 1;
1119 use constant _NumSeq_Diagonal_SE_increasing => 1;
1120 }
1121 { package Math::PlanePath::CretanLabyrinth;
1122 use constant _NumSeq_X_axis_increasing => 1;
1123 }
1124 { package Math::PlanePath::SquareArms;
1125 use constant _NumSeq_X_axis_increasing => 1;
1126 use constant _NumSeq_Y_axis_increasing => 1;
1127 use constant _NumSeq_X_neg_increasing => 1;
1128 use constant _NumSeq_Y_neg_increasing => 1;
1129 use constant _NumSeq_Diagonal_increasing => 1;
1130 use constant _NumSeq_Diagonal_NW_increasing => 1;
1131 use constant _NumSeq_Diagonal_SW_increasing => 1;
1132 use constant _NumSeq_Diagonal_SE_increasing => 1;
1133 }
1134 { package Math::PlanePath::SacksSpiral;
1135 use constant _NumSeq_X_axis_increasing => 1;
1136 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1137 use constant _NumSeq_X_neg_increasing => 1;
1138 use constant _NumSeq_Y_neg_increasing => 1;
1139 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1140 use constant _NumSeq_Diagonal_NW_increasing => 1;
1141 use constant _NumSeq_Diagonal_SW_increasing => 1;
1142 use constant _NumSeq_Diagonal_SE_increasing => 1;
1143  
1144 # SacksSpiral X_axis -- squares (i-1)^2, starting from i=1 value=0
1145 }
1146 { package Math::PlanePath::VogelFloret;
1147 use constant _NumSeq_X_axis_increasing => 1; # when touched
1148 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1149 use constant _NumSeq_X_neg_increasing => 1;
1150 use constant _NumSeq_Y_neg_increasing => 1;
1151 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1152 use constant _NumSeq_Diagonal_NW_increasing => 1;
1153 use constant _NumSeq_Diagonal_SW_increasing => 1;
1154 use constant _NumSeq_Diagonal_SE_increasing => 1;
1155 }
1156 { package Math::PlanePath::TheodorusSpiral;
1157 use constant _NumSeq_X_axis_increasing => 1; # when touched
1158 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1159 use constant _NumSeq_X_neg_increasing => 1;
1160 use constant _NumSeq_Y_neg_increasing => 1;
1161 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1162 use constant _NumSeq_Diagonal_NW_increasing => 1;
1163 use constant _NumSeq_Diagonal_SW_increasing => 1;
1164 use constant _NumSeq_Diagonal_SE_increasing => 1;
1165 }
1166 { package Math::PlanePath::ArchimedeanChords;
1167 use constant _NumSeq_X_axis_increasing => 1; # when touched
1168 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1169 use constant _NumSeq_X_neg_increasing => 1;
1170 use constant _NumSeq_Y_neg_increasing => 1;
1171 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1172 use constant _NumSeq_Diagonal_NW_increasing => 1;
1173 use constant _NumSeq_Diagonal_SW_increasing => 1;
1174 use constant _NumSeq_Diagonal_SE_increasing => 1;
1175 }
1176 { package Math::PlanePath::MultipleRings;
1177 use constant _NumSeq_X_axis_increasing => 1;
1178 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1179 use constant _NumSeq_X_neg_increasing => 1;
1180 use constant _NumSeq_Y_neg_increasing => 1;
1181 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1182 use constant _NumSeq_Diagonal_NW_increasing => 1;
1183 use constant _NumSeq_Diagonal_SW_increasing => 1;
1184 use constant _NumSeq_Diagonal_SE_increasing => 1;
1185 }
1186 { package Math::PlanePath::PixelRings;
1187 use constant _NumSeq_X_axis_increasing => 1;
1188 use constant _NumSeq_Y_axis_increasing => 1;
1189 use constant _NumSeq_X_neg_increasing => 1;
1190 use constant _NumSeq_Y_neg_increasing => 1;
1191 use constant _NumSeq_Diagonal_increasing => 1; # where covered
1192 use constant _NumSeq_Diagonal_NW_increasing => 1;
1193 use constant _NumSeq_Diagonal_SW_increasing => 1;
1194 use constant _NumSeq_Diagonal_SE_increasing => 1;
1195 }
1196 { package Math::PlanePath::FilledRings;
1197 use constant _NumSeq_X_axis_increasing => 1;
1198 use constant _NumSeq_Y_axis_increasing => 1;
1199 use constant _NumSeq_X_neg_increasing => 1;
1200 use constant _NumSeq_Y_neg_increasing => 1;
1201 use constant _NumSeq_Diagonal_increasing => 1;
1202 use constant _NumSeq_Diagonal_NW_increasing => 1;
1203 use constant _NumSeq_Diagonal_SW_increasing => 1;
1204 use constant _NumSeq_Diagonal_SE_increasing => 1;
1205  
1206 # use constant _NumSeq_N_oeis_anum =>
1207 # {
1208 # # Not quite, A036704 OFFSET=0 value=1,9,21 vs X=0 value=0,1,9,21
1209 # 'n_start=0' =>
1210 # { X_axis => 'A036704', # count points norm <= n+1/2
1211 # },
1212 # };
1213 }
1214 { package Math::PlanePath::Hypot;
1215 sub _NumSeq_X_axis_i_start {
1216 my ($self) = @_;
1217 ### _NumSeq_X_axis_i_start() ...
1218 return ($self->{'points'} eq 'odd'
1219 ? 1 # X=0,Y=0 not visited
1220 : 0);
1221 }
1222 sub _NumSeq_X_neg_i_start {
1223 my ($self) = @_;
1224 ### _NumSeq_X_axis_i_start() ...
1225 return ($self->{'points'} eq 'odd'
1226 ? -1 # X=0,Y=0 not visited
1227 : 0);
1228 }
1229 *_NumSeq_Y_axis_i_start = \&_NumSeq_X_axis_i_start;
1230 *_NumSeq_Y_neg_i_start = \&_NumSeq_X_neg_i_start;
1231  
1232 use constant _NumSeq_X_axis_increasing => 1;
1233 use constant _NumSeq_Y_axis_increasing => 1;
1234 use constant _NumSeq_X_neg_increasing => 1;
1235 use constant _NumSeq_Y_neg_increasing => 1;
1236 use constant _NumSeq_Diagonal_increasing => 1;
1237 use constant _NumSeq_Diagonal_NW_increasing => 1;
1238 use constant _NumSeq_Diagonal_SW_increasing => 1;
1239 use constant _NumSeq_Diagonal_SE_increasing => 1;
1240  
1241 use constant _NumSeq_N_oeis_anum =>
1242 { 'points=all,n_start=0' =>
1243 { X_axis => 'A051132', # count points < n^2
1244 # OEIS-Catalogue: A051132 planepath=Hypot,n_start=0
1245 },
1246 };
1247 }
1248 { package Math::PlanePath::HypotOctant;
1249 use constant _NumSeq_X_axis_increasing => 1;
1250 use constant _NumSeq_Y_axis_increasing => 1;
1251 use constant _NumSeq_Diagonal_increasing => 1;
1252 *_NumSeq_X_axis_i_start = \&Math::PlanePath::Hypot::_NumSeq_X_axis_i_start;
1253  
1254 use constant _NumSeq_N_oeis_anum =>
1255 { 'points=even' =>
1256 { Diagonal => 'A036702', # count points |z|<=n for 0<=b<=a
1257 # OEIS-Catalogue: A036702 planepath=HypotOctant,points=even line_type=Diagonal
1258 },
1259 };
1260 }
1261 { package Math::PlanePath::TriangularHypot;
1262 sub _NumSeq_X_axis_i_start {
1263 my ($self) = @_;
1264 return ($self->{'points'} eq 'odd' || $self->{'points'} eq 'hex_centred'
1265 ? 1 # X=0,Y=0 not visited
1266 : 0);
1267 }
1268 *_NumSeq_Diagonal_i_start = \&_NumSeq_X_axis_i_start;
1269 *_NumSeq_Diagonal_SE_i_start = \&_NumSeq_X_axis_i_start;
1270 sub _NumSeq_X_neg_i_start {
1271 my ($self) = @_;
1272 return - $self->_NumSeq_X_axis_i_start;
1273 }
1274 *_NumSeq_Diagonal_NW_i_start = \&_NumSeq_X_axis_i_start;
1275 *_NumSeq_Diagonal_SW_i_start = \&_NumSeq_X_axis_i_start;
1276 use constant _NumSeq_X_axis_increasing => 1;
1277 use constant _NumSeq_Y_axis_increasing => 1;
1278 use constant _NumSeq_X_neg_increasing => 1;
1279 use constant _NumSeq_Y_neg_increasing => 1;
1280 use constant _NumSeq_Diagonal_increasing => 1;
1281 use constant _NumSeq_Diagonal_NW_increasing => 1;
1282 use constant _NumSeq_Diagonal_SW_increasing => 1;
1283 use constant _NumSeq_Diagonal_SE_increasing => 1;
1284 }
1285 { package Math::PlanePath::PythagoreanTree;
1286 use constant _NumSeq_X_axis_increasing => 1;
1287  
1288 use constant _NumSeq_N_oeis_all_anum =>
1289 { Depth_start => 'A007051', # (3^n+1)/2
1290 # OEIS-Catalogue: A007051 planepath=PythagoreanTree line_type=Depth_start
1291  
1292 # Not quite, Depth_end=(3^(n+1)-1)/2, so is n+1
1293 # Depth_end => 'A003462', # (3^n-1)/2
1294 };
1295 }
1296 { package Math::PlanePath::RationalsTree;
1297 use constant _NumSeq_X_axis_increasing => 1;
1298  
1299 sub _NumSeq_Y_axis_increasing {
1300 my ($self) = @_;
1301 return ($self->{'tree_type'} eq 'L' ? 0 : 1);
1302 }
1303 sub _NumSeq_Y_axis_increasing_from_i {
1304 my ($self) = @_;
1305 return ($self->{'tree_type'} eq 'L' ? 2 : 1);
1306 }
1307 use constant _NumSeq_Y_axis_min => 1;
1308 use constant _NumSeq_Diagonal_increasing => 1;
1309  
1310 use constant _NumSeq_N_oeis_anum =>
1311 { 'tree_type=SB' =>
1312 { Depth_start => 'A000079', # powers-of-2
1313 # RationalsTree SB -- X_axis 2^n-1 but starting X=1
1314 # RationalsTree SB,CW -- Y_axis A000079 2^n but starting Y=1
1315 },
1316  
1317 'tree_type=CW' =>
1318 { Depth_start => 'A000079', # powers-of-2
1319 },
1320  
1321 'tree_type=Bird' =>
1322 { X_axis => 'A081254', # local max sumdisttopow2(m)/m^2
1323 Depth_start => 'A000079', # powers-of-2
1324 # OEIS-Catalogue: A081254 planepath=RationalsTree,tree_type=Bird
1325 # OEIS-Other: A000079 planepath=RationalsTree,tree_type=Bird line_type=Depth_start
1326  
1327 # RationalsTree Bird -- Y_axis almost A000975 10101 101010 no
1328 # consecutive equal bits, but start=1
1329 },
1330  
1331 'tree_type=Drib' =>
1332 { X_axis => 'A086893', # pos of fibonacci F(n+1)/F(n) in Stern diatomic
1333 Depth_start => 'A000079', # powers-of-2
1334 # OEIS-Catalogue: A086893 planepath=RationalsTree,tree_type=Drib
1335  
1336 # Drib Y_axis
1337 # Not quite, A061547 OFFSET=1 value=0 cf path Y=1 value N=1
1338 # Y_axis => 'A061547'# derangements or alternating bits plus pow4
1339 },
1340  
1341 'tree_type=AYT' =>
1342 { Depth_start => 'A000079', # powers-of-2
1343 # RationalsTree AYT -- Y_axis A083318 2^n+1 but starting Y=1
1344 },
1345  
1346 'tree_type=HCS' =>
1347 { Depth_start => 'A000079', # powers-of-2
1348  
1349 # RationalsTree HCS
1350 # Not quite, A000079 OFFSET=0 value=1 cf here X=1 N=1
1351 # X_axis => 'A000079', # powers 2^X
1352 # Not quite, A007283 OFFSET=0 and doesn't have extra N=1 at Y=1
1353 # Y_axis => 'A007283', # 3*2^n starting OFFSET=0 value=3
1354 },
1355 };
1356 }
1357 { package Math::PlanePath::FractionsTree;
1358 use constant _NumSeq_Diagonal_increasing => 1;
1359 use constant _NumSeq_Diagonal_X_offset => -1;
1360  
1361 use constant _NumSeq_Y_axis_increasing => 1;
1362 use constant _NumSeq_Y_axis_i_start => 2;
1363 }
1364 { package Math::PlanePath::ChanTree;
1365 use constant _NumSeq_X_axis_increasing => 1;
1366 use constant _NumSeq_X_axis_i_start => 1;
1367  
1368 use constant _NumSeq_Y_axis_i_start => 1; # start at Y=1
1369 use constant _NumSeq_Y_axis_increasing => 1;
1370  
1371 use constant _NumSeq_Diagonal_increasing => 1;
1372  
1373 use constant _NumSeq_N_oeis_anum =>
1374 { 'k=2,n_start=1' =>
1375 { Depth_start => 'A000079', # powers-of-2
1376 # OEIS-Other: A000079 planepath=ChanTree,n_start=1,k=2 line_type=Depth_start
1377  
1378 # Depth_end is 2^k-1 A000225, or 2^k-2 A000918, but without initial
1379 # 0 or -1.
1380 },
1381 'k=2,n_start=0' =>
1382 { Depth_start => 'A000225', # 2^k-1
1383 # OEIS-Other: A000225 planepath=ChanTree,k=2 line_type=Depth_start
1384 },
1385  
1386 'k=3,n_start=1' =>
1387 { Depth_start => 'A000244', # powers-of-3
1388 # OEIS-Other: A000244 planepath=ChanTree,n_start=1 line_type=Depth_start
1389 },
1390 'k=4,n_start=1' =>
1391 { Depth_start => 'A000302', # powers-of-4
1392 # OEIS-Other: A000302 planepath=ChanTree,n_start=1,k=4 line_type=Depth_start
1393 },
1394 'k=5,n_start=1' =>
1395 { Depth_start => 'A000351', # powers-of-5
1396 # OEIS-Other: A000351 planepath=ChanTree,n_start=1,k=5 line_type=Depth_start
1397 },
1398 'k=10,n_start=1' =>
1399 { Depth_start => 'A011557', # powers-of-10
1400 # OEIS-Other: A011557 planepath=ChanTree,n_start=1,k=10 line_type=Depth_start
1401 },
1402 };
1403 }
1404 { package Math::PlanePath::DiagonalRationals;
1405 use constant _NumSeq_X_axis_increasing => 1;
1406 use constant _NumSeq_Y_axis_increasing => 1;
1407 use constant _NumSeq_X_axis_i_start => 1;
1408 use constant _NumSeq_Y_axis_i_start => 1;
1409  
1410 # Diagonal => 'A002088', # cumulative totient
1411 # Not quite, start X=1 value=1 cf seq OFFSET=0 value=0
1412 }
1413 { package Math::PlanePath::FactorRationals;
1414 use constant _NumSeq_X_axis_i_start => 1;
1415 sub _NumSeq_X_axis_increasing {
1416 my ($self) = @_;
1417 # perfect squares along X axis of even/odd
1418 return $self->{'factor_coding'} eq 'even/odd';
1419 }
1420  
1421 use constant _NumSeq_Y_axis_i_start => 1;
1422 sub _NumSeq_Y_axis_increasing {
1423 my ($self) = @_;
1424 # perfect squares along Y axis of odd/even
1425 return $self->{'factor_coding'} eq 'odd/even';
1426 }
1427  
1428 use constant _NumSeq_N_oeis_anum =>
1429 { 'factor_coding=even/odd' =>
1430 { Y_axis => 'A102631', # n^2/(squarefree kernel)
1431 # OEIS-Catalogue: A102631 planepath=FactorRationals line_type=Y_axis
1432  
1433 # # Not quite, OFFSET=0 value 0 whereas start X=Y=1 value 1 here
1434 # X_axis => 'A000290', # squares 0,1,4,9
1435 # # OEIS-Other: A000290 planepath=FactorRationals
1436 },
1437 'factor_coding=odd/even' =>
1438 { X_axis => 'A102631', # n^2/(squarefree kernel)
1439 # OEIS-Other: A102631 planepath=FactorRationals,factor_coding=odd/even
1440 },
1441 };
1442 }
1443 { package Math::PlanePath::GcdRationals;
1444 use constant _NumSeq_X_axis_increasing => 1;
1445 use constant _NumSeq_Y_axis_increasing => 1;
1446 use constant _NumSeq_X_axis_i_start => 1;
1447 use constant _NumSeq_Y_axis_i_start => 1;
1448  
1449 # GcdRationals
1450 # Not quite, starts X=1
1451 # X_axis => triangular row
1452 # Not quite, starts X=1 here cf OFFSET=0 in A000124
1453 # Y_axis => 'A000124', # triangular+1
1454 #
1455 # GcdRationals,pairs_order=diagonals_down
1456 # Not quite, start X=1 here cf A000290 starts OFFSET=1
1457 # X_axis => 'A000290', # Y=1 row, perfect squares
1458 # Not quite, A033638 starts two ones 1,1,...
1459 # Y_axis => 'A033638', # quarter-squares + 1
1460 #
1461 # GcdRationals,pairs_order=diagonals_up
1462 # Not quite, A002061 starts two ones 1,1,
1463 # X_axis => 'A002061',
1464 # Not quite, X=1 column squares+pronic, but no initial 0,0 of A002620
1465 # Y_axis => 'A002620', # X=1 column
1466 # Not quite, starting value=2 here
1467 # Diagonal_above => 'A002522', # Y=X+1 diagonal, squares+1
1468 }
1469 { package Math::PlanePath::CfracDigits;
1470 # 1
1471 # diagonal Y/(Y+1) = 0 + -----
1472 # 1 + 1/Y
1473 # q0=1 q1=Y
1474 # N = 3,Y-1 in 1,2,3
1475 # = 1,0,Y-1 in 0,1,2
1476 #
1477 use constant _NumSeq_Diagonal_increasing => 1;
1478 use constant _NumSeq_Diagonal_X_offset => -1;
1479 use constant _NumSeq_Y_axis_increasing => 1; # radix without digit 0
1480 }
1481 { package Math::PlanePath::PeanoCurve;
1482 sub _NumSeq_X_axis_increasing {
1483 my ($self) = @_;
1484 return ($self->{'radix'} % 2);
1485 }
1486 *_NumSeq_Y_axis_increasing = \&_NumSeq_X_axis_increasing;
1487  
1488 use constant _NumSeq_N_oeis_anum =>
1489 { 'radix=3' =>
1490 { X_axis => 'A163480', # axis same as initial direction
1491 Y_axis => 'A163481', # axis opp to initial direction
1492 Diagonal => 'A163343',
1493 },
1494 # OEIS-Catalogue: A163480 planepath=PeanoCurve
1495 # OEIS-Catalogue: A163481 planepath=PeanoCurve line_type=Y_axis
1496 # OEIS-Catalogue: A163343 planepath=PeanoCurve line_type=Diagonal
1497  
1498 # OEIS-Other: A163480 planepath=GrayCode,apply_type=TsF,radix=3
1499 # OEIS-Other: A163481 planepath=GrayCode,apply_type=TsF,radix=3 line_type=Y_axis
1500 # OEIS-Other: A163343 planepath=GrayCode,apply_type=TsF,radix=3 line_type=Diagonal
1501  
1502 # OEIS-Other: A163480 planepath=GrayCode,apply_type=FsT,radix=3
1503 # OEIS-Other: A163481 planepath=GrayCode,apply_type=FsT,radix=3 line_type=Y_axis
1504 # OEIS-Other: A163343 planepath=GrayCode,apply_type=FsT,radix=3 line_type=Diagonal
1505 };
1506 }
1507 # { package Math::PlanePath::PeanoDiagonals;
1508 # }
1509 { package Math::PlanePath::WunderlichSerpentine;
1510 sub _NumSeq_X_axis_increasing {
1511 my ($self) = @_;
1512 if ($self->{'radix'} % 2) {
1513 return 1; # odd radix always increasing
1514 }
1515 # FIXME: depends on the serpentine_type bits
1516 return 0;
1517 }
1518 sub _NumSeq_Y_axis_increasing {
1519 my ($self) = @_;
1520 if ($self->{'radix'} % 2) {
1521 return 1; # odd radix always increasing
1522 }
1523 # FIXME: depends on the serpentine_type bits
1524 return 0;
1525 }
1526 }
1527 { package Math::PlanePath::HilbertCurve;
1528 use constant _NumSeq_X_axis_increasing => 1;
1529 use constant _NumSeq_Y_axis_increasing => 1;
1530 use constant _NumSeq_Diagonal_increasing => 1;
1531  
1532 use constant _NumSeq_N_oeis_anum =>
1533 { '' =>
1534 { X_axis => 'A163482',
1535 Y_axis => 'A163483',
1536 Diagonal => 'A062880', # base 4 digits 0,2 only
1537 # OEIS-Catalogue: A163482 planepath=HilbertCurve
1538 # OEIS-Catalogue: A163483 planepath=HilbertCurve line_type=Y_axis
1539 # OEIS-Other: A062880 planepath=HilbertCurve line_type=Diagonal
1540 },
1541 };
1542 }
1543 { package Math::PlanePath::HilbertSides;
1544 use constant _NumSeq_X_axis_increasing => 1;
1545 use constant _NumSeq_Y_axis_increasing => 1;
1546 use constant _NumSeq_Diagonal_increasing => 1;
1547  
1548 use constant _NumSeq_N_oeis_anum =>
1549 { '' =>
1550 { Diagonal => 'A062880', # base 4 digits 0,2 only
1551 # OEIS-Other: A062880 planepath=HilbertSides line_type=Diagonal
1552 },
1553 };
1554 }
1555 { package Math::PlanePath::HilbertSpiral;
1556 use constant _NumSeq_Diagonal_increasing => 1;
1557 use constant _NumSeq_Diagonal_SW_increasing => 1;
1558 }
1559 { package Math::PlanePath::ZOrderCurve;
1560 use constant _NumSeq_X_axis_increasing => 1;
1561 use constant _NumSeq_Y_axis_increasing => 1;
1562 use constant _NumSeq_Diagonal_increasing => 1;
1563  
1564 use constant _NumSeq_N_oeis_anum =>
1565 { 'radix=2' =>
1566 { X_axis => 'A000695', # base 4 digits 0,1 only (RadixConversion)
1567 Y_axis => 'A062880', # base 4 digits 0,2 only
1568 Diagonal => 'A001196', # base 4 digits 0,3 only
1569 # OEIS-Other: A000695 planepath=ZOrderCurve
1570 # OEIS-Catalogue: A062880 planepath=ZOrderCurve line_type=Y_axis
1571 # OEIS-Catalogue: A001196 planepath=ZOrderCurve line_type=Diagonal
1572 },
1573 'radix=3' =>
1574 { X_axis => 'A037314', # base 9 digits 0,1,2 only
1575 # OEIS-Catalogue: A037314 planepath=ZOrderCurve,radix=3
1576 },
1577 'radix=3,i_start=1' =>
1578 { Y_axis => 'A208665', # base 9 digits 0,3,6 only, starting OFFSET=1 value=3
1579 # OEIS-Catalogue: A208665 planepath=ZOrderCurve,radix=3 i_start=1 line_type=Y_axis
1580  
1581 # ZOrderCurve dir=2 radix,3: match 6,27,30,33,54,57,60,243,246,249,270,273,276,297,300
1582 # A208665 Numbers that match odd ternary polynomials; see Comments.
1583 # 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,
1584 # base 9 digits 0,3,6 only
1585 },
1586 'radix=10' =>
1587 { X_axis => 'A051022', # base 10 insert 0s, for digits 0 to 9 base 100
1588 # OEIS-Catalogue: A051022 planepath=ZOrderCurve,radix=10
1589 },
1590 };
1591 }
1592 { package Math::PlanePath::GrayCode;
1593  
1594 # X axis increasing for:
1595 # radix=2 TsF,Fs
1596 # radix=3 reflected TsF,FsT
1597 # radix=3 modular TsF,Fs
1598 # radix=4 reflected TsF,Fs
1599 # radix=4 modular TsF,Fs
1600 # radix=5 reflected TsF,FsT
1601 # radix=5 modular TsF,Fs
1602 #
1603 sub _NumSeq_X_axis_increasing {
1604 my ($self) = @_;
1605 if ($self->{'gray_type'} eq 'modular' || $self->{'radix'} == 2) {
1606 return ($self->{'apply_type'} eq 'TsF'
1607 || $self->{'apply_type'} eq 'Fs');
1608 }
1609 if ($self->{'radix'} & 1) {
1610 return ($self->{'apply_type'} eq 'TsF'
1611 || $self->{'apply_type'} eq 'FsT');
1612 } else {
1613 return ($self->{'apply_type'} eq 'TsF'
1614 || $self->{'apply_type'} eq 'Fs');
1615 }
1616 }
1617 *_NumSeq_Y_axis_increasing = \&_NumSeq_X_axis_increasing;
1618  
1619 # Diagonal increasing for:
1620 # radix=2 FsT,Ts
1621 # radix=3 reflected Ts,Fs
1622 # radix=3 modular FsT
1623 # radix=4 reflected FsT,Ts
1624 # radix=4 modular FsT
1625 # radix=5 reflected Ts,Fs
1626 # radix=5 modular FsT
1627 sub _NumSeq_Diagonal_increasing {
1628 my ($self) = @_;
1629 if ($self->{'radix'} & 1) {
1630 if ($self->{'gray_type'} eq 'modular') {
1631 return ($self->{'apply_type'} eq 'FsT'); # odd modular
1632 } else {
1633 return ($self->{'apply_type'} eq 'Ts'
1634 || $self->{'apply_type'} eq 'Fs'); # odd reflected
1635 }
1636 }
1637 if ($self->{'gray_type'} eq 'reflected' || $self->{'radix'} == 2) {
1638 return ($self->{'apply_type'} eq 'FsT'
1639 || $self->{'apply_type'} eq 'Ts'); # even reflected
1640 } else {
1641 return ($self->{'apply_type'} eq 'FsT'); # even modular
1642 }
1643 }
1644  
1645 use constant _NumSeq_N_oeis_anum =>
1646 {
1647 'apply_type=TsF,gray_type=reflected,radix=3' =>
1648 (Math::PlanePath::PeanoCurve->_NumSeq_N_oeis_anum->{'radix=3'}
1649 || die "Oops, SquareSpiral NumSeq PlanePathN not found"),
1650 'apply_type=FsT,gray_type=reflected,radix=3' =>
1651 (Math::PlanePath::PeanoCurve->_NumSeq_N_oeis_anum->{'radix=3'}
1652 || die "Oops, SquareSpiral NumSeq PlanePathN not found"),
1653  
1654 # GrayCode radix=2 TsF==Fs reflected==modular
1655 do {
1656 my $href =
1657 { Y_axis => 'A001196', # base 4 digits 0,3 only
1658 };
1659 ('apply_type=TsF,gray_type=reflected,radix=2' => $href,
1660 'apply_type=Fs,gray_type=reflected,radix=2' => $href,
1661 'apply_type=TsF,gray_type=modular,radix=2' => $href,
1662 'apply_type=Fs,gray_type=modular,radix=2' => $href,
1663 );
1664 # OEIS-Other: A001196 planepath=GrayCode,apply_type=TsF line_type=Y_axis
1665 # OEIS-Other: A001196 planepath=GrayCode,apply_type=Fs line_type=Y_axis
1666 # OEIS-Other: A001196 planepath=GrayCode,apply_type=TsF,gray_type=modular line_type=Y_axis
1667 # OEIS-Other: A001196 planepath=GrayCode,apply_type=Fs,gray_type=modular line_type=Y_axis
1668 },
1669 # GrayCode radix=2 Ts==FsT reflected==modular
1670 do {
1671 my $href =
1672 { Diagonal => 'A062880', # base 4 digits 0,2 only
1673 };
1674 ('apply_type=Ts,gray_type=reflected,radix=2' => $href,
1675 'apply_type=Ts,gray_type=modular,radix=2' => $href,
1676 'apply_type=FsT,gray_type=reflected,radix=2' => $href,
1677 'apply_type=FsT,gray_type=modular,radix=2' => $href,
1678 );
1679 # OEIS-Other: A062880 planepath=GrayCode,apply_type=Ts line_type=Diagonal
1680 # OEIS-Other: A062880 planepath=GrayCode,apply_type=Ts,gray_type=modular line_type=Diagonal
1681 # OEIS-Other: A062880 planepath=GrayCode,apply_type=FsT line_type=Diagonal
1682 # OEIS-Other: A062880 planepath=GrayCode,apply_type=FsT,gray_type=modular line_type=Diagonal
1683 },
1684  
1685 # GrayCode radix=3 sT==sF reflected
1686 # N split then toGray giving Y=0 means N ternary 010202 etc
1687 # N split then toGray giving X=Y means N ternary pairs 112200
1688 do {
1689 my $href =
1690 { X_axis => 'A163344', # central Peano/4, base9 digits 0,1,2 only
1691 Diagonal => 'A163343', # central diagonal of Peano, base9 0,4,8
1692 };
1693 ('apply_type=sT,gray_type=reflected,radix=3' => $href,
1694 'apply_type=sF,gray_type=reflected,radix=3' => $href,
1695 );
1696 # OEIS-Catalogue: A163344 planepath=GrayCode,apply_type=sT,radix=3
1697 # OEIS-Other: A163344 planepath=GrayCode,apply_type=sF,radix=3
1698  
1699 # OEIS-Other: A163343 planepath=GrayCode,apply_type=sT,radix=3 line_type=Diagonal
1700 # OEIS-Other: A163343 planepath=GrayCode,apply_type=sF,radix=3 line_type=Diagonal
1701 },
1702  
1703 'apply_type=FsT,gray_type=modular,radix=3,i_start=1' =>
1704 { Diagonal => 'A208665', # base 9 digits 0,3,6
1705 # OEIS-Other: A208665 planepath=GrayCode,apply_type=FsT,gray_type=modular,radix=3 line_type=Diagonal i_start=1
1706 },
1707 };
1708 }
1709 # { package Math::PlanePath::ImaginaryBase;
1710 # }
1711 { package Math::PlanePath::ImaginaryHalf;
1712 use constant _NumSeq_Y_axis_increasing => 1;
1713  
1714 use constant _NumSeq_N_oeis_anum =>
1715 { 'radix=2,digit_order=YXX' =>
1716 { Y_axis => 'A033045', # base 8 digits 0,1 only
1717 # OEIS-Other: A033045 planepath=ImaginaryHalf,digit_order=YXX line_type=Y_axis
1718 },
1719 'radix=2,digit_order=YXnX' =>
1720 { Y_axis => 'A033045', # base 8 digits 0,1 only
1721 # OEIS-Other: A033045 planepath=ImaginaryHalf,digit_order=YXnX line_type=Y_axis
1722 },
1723 };
1724 }
1725 # { package Math::PlanePath::CubicBase;
1726 # }
1727 { package Math::PlanePath::DekkingCurve;
1728 sub _NumSeq_X_axis_increasing {
1729 my ($self) = @_;
1730 # arms=4 has various interleaving
1731 return $self->{'arms'} < 4;
1732 }
1733 sub _NumSeq_X_neg_increasing {
1734 my ($self) = @_;
1735 # arms=3 has various interleaving
1736 return $self->{'arms'} < 3;
1737 }
1738 sub _NumSeq_Y_axis_increasing {
1739 my ($self) = @_;
1740 # arms=2 has various interleaving
1741 return $self->{'arms'} < 2;
1742 }
1743 sub _NumSeq_Y_neg_increasing {
1744 my ($self) = @_;
1745 # arms=4 has various interleaving
1746 return $self->{'arms'} < 4;
1747 }
1748 }
1749 { package Math::PlanePath::DekkingCentres;
1750 use constant _NumSeq_X_axis_increasing => 1;
1751 use constant _NumSeq_Y_axis_increasing => 1;
1752 }
1753 { package Math::PlanePath::CincoCurve;
1754 use constant _NumSeq_X_axis_increasing => 1;
1755 use constant _NumSeq_Y_axis_increasing => 1;
1756 }
1757 { package Math::PlanePath::BetaOmega;
1758 use constant _NumSeq_X_axis_increasing => 1;
1759 use constant _NumSeq_Y_axis_increasing => 1;
1760 use constant _NumSeq_Y_neg_increasing => 1;
1761 }
1762 { package Math::PlanePath::KochelCurve;
1763 use constant _NumSeq_X_axis_increasing => 1;
1764 use constant _NumSeq_Y_axis_increasing => 1;
1765 }
1766 { package Math::PlanePath::AR2W2Curve;
1767 use constant _NumSeq_X_axis_increasing => 1;
1768 use constant _NumSeq_Y_axis_increasing => 1;
1769 use constant _NumSeq_Diagonal_increasing => 1;
1770 }
1771 { package Math::PlanePath::WunderlichMeander;
1772 use constant _NumSeq_X_axis_increasing => 1;
1773 use constant _NumSeq_Y_axis_increasing => 1;
1774 }
1775 # { package Math::PlanePath::Flowsnake;
1776 # }
1777 # { package Math::PlanePath::FlowsnakeCentres;
1778 # # inherit from Flowsnake
1779 # }
1780 # { package Math::PlanePath::GosperIslands;
1781 # }
1782 # { package Math::PlanePath::GosperSide;
1783 # }
1784 { package Math::PlanePath::KochCurve;
1785 use constant _NumSeq_X_axis_increasing => 1; # when touched
1786 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1787 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1788 }
1789 { package Math::PlanePath::KochPeaks;
1790 use constant _NumSeq_X_axis_increasing => 1; # when touched
1791 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1792 use constant _NumSeq_X_neg_increasing => 1; # when touched
1793 # Diagonal never touched
1794 }
1795 { package Math::PlanePath::KochSnowflakes;
1796 use constant _NumSeq_X_axis_increasing => 1; # when touched
1797 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1798 use constant _NumSeq_X_neg_increasing => 1;
1799 use constant _NumSeq_Y_neg_increasing => 1;
1800 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1801 use constant _NumSeq_Diagonal_NW_increasing => 1;
1802 use constant _NumSeq_Diagonal_SW_increasing => 1;
1803 use constant _NumSeq_Diagonal_SE_increasing => 1;
1804 }
1805 { package Math::PlanePath::KochSquareflakes;
1806 use constant _NumSeq_X_axis_increasing => 1; # when touched
1807 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1808 use constant _NumSeq_X_neg_increasing => 1;
1809 use constant _NumSeq_Y_neg_increasing => 1;
1810 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1811 use constant _NumSeq_Diagonal_NW_increasing => 1;
1812 use constant _NumSeq_Diagonal_SW_increasing => 1;
1813 use constant _NumSeq_Diagonal_SE_increasing => 1;
1814 }
1815 { package Math::PlanePath::QuadricCurve;
1816 use constant _NumSeq_X_axis_increasing => 1; # when touched
1817 use constant _NumSeq_Diagonal_increasing => 1; # two values only
1818 }
1819 { package Math::PlanePath::QuadricIslands;
1820 # FIXME: pred() on Diagonal_SW doesn't notice 0.5 square
1821 use constant _NumSeq_X_axis_increasing => 1; # when touched
1822 use constant _NumSeq_Y_axis_increasing => 1;
1823  
1824 use constant _NumSeq_X_neg_increasing => 1;
1825  
1826 use constant _NumSeq_Y_neg_increasing => 0;
1827 use constant _NumSeq_Y_neg_increasing_from_i => 1; # after 3,2,8
1828 use constant _NumSeq_Y_neg_min => 2; # at X=-1,Y=0 rather than X=0,Y=0
1829 use constant _NumSeq_Diagonal_SW_increasing => 0;
1830 use constant _NumSeq_Diagonal_SW_min => 1;
1831 }
1832 { package Math::PlanePath::SierpinskiTriangle;
1833 use constant _NumSeq_X_axis_increasing => 1; # for "diagonal" style
1834 use constant _NumSeq_Y_axis_increasing => 1;
1835 use constant _NumSeq_Diagonal_increasing => 1;
1836 use constant _NumSeq_Diagonal_NW_increasing => 1;
1837  
1838 # low 10111=23 increment to 11000=24
1839 # 10111 ones=4 width=2^4
1840  
1841 # cf A160722 is 3*A006046-2*n, drawing three Sierpinski triangles
1842 # http://www.polprimos.com/imagenespub/polca722.jpg
1843 #
1844 use constant _NumSeq_N_oeis_anum =>
1845 {
1846 #---------
1847 # i_start=0, n_start=0
1848  
1849 'align=triangular,n_start=0' =>
1850 { Diagonal_NW => 'A006046',
1851 Depth_start => 'A006046',
1852 # OEIS-Other: A006046 planepath=SierpinskiTriangle line_type=Diagonal_NW
1853 # OEIS-Other: A006046 planepath=SierpinskiTriangle line_type=Depth_start
1854 },
1855 'align=right,n_start=0' =>
1856 { Y_axis => 'A006046',
1857 Depth_start => 'A006046',
1858 # OEIS-Catalogue: A006046 planepath=SierpinskiTriangle,align=diagonal,n_start=0 line_type=Y_axis
1859 },
1860 'align=left,n_start=0' =>
1861 { Diagonal_NW => 'A006046',
1862 Depth_start => 'A006046',
1863 # OEIS-Other: A006046 planepath=SierpinskiTriangle,align=left,n_start=0 line_type=Diagonal_NW
1864 },
1865 'align=diagonal,n_start=0' =>
1866 { Y_axis => 'A006046',
1867 Depth_start => 'A006046',
1868 # OEIS-Other: A006046 planepath=SierpinskiTriangle,align=diagonal,n_start=0 line_type=Y_axis
1869 },
1870  
1871 #---------
1872 # i_start=1, n_start=0
1873  
1874 # starting OFFSET=1 value=2,4,8,10 so missing N=0 at Y=0, hence i_start=1
1875 'align=triangular,n_start=0,i_start=1' =>
1876 { Diagonal => 'A074330',
1877 Depth_end => 'A074330',
1878 # OEIS-Catalogue: A074330 planepath=SierpinskiTriangle line_type=Diagonal i_start=1
1879 # OEIS-Other: A074330 planepath=SierpinskiTriangle line_type=Depth_end i_start=1
1880 },
1881 'align=right,n_start=0,i_start=1' =>
1882 { Diagonal => 'A074330',
1883 Depth_end => 'A074330',
1884 # OEIS-Other: A074330 planepath=SierpinskiTriangle,align=right line_type=Diagonal i_start=1
1885 },
1886 'align=left,n_start=0,i_start=1' =>
1887 { Y_axis => 'A074330',
1888 Depth_end => 'A074330',
1889 # OEIS-Other: A074330 planepath=SierpinskiTriangle,align=left line_type=Y_axis i_start=1
1890 },
1891 'align=diagonal,n_start=0,i_start=1' =>
1892 { X_axis => 'A074330',
1893 Depth_end => 'A074330',
1894 # OEIS-Other: A074330 planepath=SierpinskiTriangle,align=diagonal i_start=1
1895 },
1896 };
1897 }
1898 { package Math::PlanePath::SierpinskiArrowhead;
1899 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1900 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1901 use constant _NumSeq_Diagonal_NW_increasing => 1;
1902 # align="diagonal" is X increasing, other align is single origin point only
1903 use constant _NumSeq_X_axis_increasing => 1;
1904 }
1905 { package Math::PlanePath::SierpinskiArrowheadCentres;
1906 use constant _NumSeq_Y_axis_increasing => 1; # never touched ?
1907 use constant _NumSeq_Diagonal_increasing => 1;
1908 use constant _NumSeq_Diagonal_NW_increasing => 1;
1909 # align="diagonal" is X increasing, other align is single origin point only
1910 use constant _NumSeq_X_axis_increasing => 1;
1911 }
1912 { package Math::PlanePath::SierpinskiCurve;
1913 use constant _NumSeq_X_axis_increasing => 1; # when touched
1914 use constant _NumSeq_X_axis_i_start => 1; # but not all cells visited
1915  
1916 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1917 use constant _NumSeq_Y_axis_i_start => 1; # but not all cells visited
1918  
1919 use constant _NumSeq_X_neg_increasing => 1; # arms
1920 use constant _NumSeq_Y_neg_increasing => 1; # arms
1921  
1922 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1923 use constant _NumSeq_Diagonal_NW_increasing => 1;
1924  
1925 use constant _NumSeq_Diagonal_SW_increasing => 1;
1926 use constant _NumSeq_Diagonal_SE_increasing => 1;
1927 }
1928 { package Math::PlanePath::SierpinskiCurveStair;
1929 use constant _NumSeq_X_axis_increasing => 1; # when touched
1930 use constant _NumSeq_Y_axis_increasing => 1; # when touched
1931 use constant _NumSeq_X_neg_increasing => 1; # arms
1932 use constant _NumSeq_Y_neg_increasing => 1; # arms
1933 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1934 use constant _NumSeq_Diagonal_NW_increasing => 1;
1935 use constant _NumSeq_Diagonal_SW_increasing => 1;
1936 use constant _NumSeq_Diagonal_SE_increasing => 1;
1937 }
1938 { package Math::PlanePath::HIndexing;
1939 use constant _NumSeq_X_axis_increasing => 1; # when touched
1940 use constant _NumSeq_Y_axis_increasing => 1;
1941 use constant _NumSeq_Diagonal_increasing => 1; # when touched
1942 }
1943 # { package Math::PlanePath::DragonCurve;
1944 # }
1945 # { package Math::PlanePath::DragonRounded;
1946 # }
1947 # { package Math::PlanePath::DragonMidpoint;
1948 # }
1949 { package Math::PlanePath::AlternatePaper;
1950 use constant _NumSeq_X_axis_increasing => 1;
1951 use constant _NumSeq_Y_axis_increasing => 1;
1952 use constant _NumSeq_Diagonal_increasing => 1;
1953 use constant _NumSeq_Diagonal_NW_increasing => 1; # arms
1954 use constant _NumSeq_Diagonal_SW_increasing => 1;
1955 use constant _NumSeq_Diagonal_SE_increasing => 1;
1956 # selecting the smaller N on the negative axes gives increasing, maybe
1957 use constant _NumSeq_X_neg_increasing => 1;
1958 use constant _NumSeq_Y_neg_increasing => 1;
1959  
1960 use constant _NumSeq_N_oeis_anum =>
1961 { 'arms=1' =>
1962 { X_axis => 'A000695', # base 4 digits 0,1 only
1963 Diagonal => 'A062880', # base 4 digits 0,2 only
1964 # OEIS-Other: A000695 planepath=AlternatePaper
1965 # OEIS-Other: A062880 planepath=AlternatePaper line_type=Diagonal
1966 },
1967 # FIXME: not sure what to do when multiple-visited points on axes
1968 # 'arms=2' =>
1969 # { X_axis => 'A062880', # base 4 digits 0,2 only
1970 # Y_axis => 'A145812', # base 4 digits 0,2 only except low digit 1,3 only
1971 # # OEIS-Other: A062880 planepath=AlternatePaper,arms=2
1972 # # OEIS-Catalogue: A145812 planepath=AlternatePaper,arms=2 line_type=Y_axis
1973 # },
1974 # 'arms=3' =>
1975 # { X_axis => 'A001196', # base 4 digits 0,3 only
1976 # # OEIS-Other: A001196 planepath=AlternatePaper,arms=3
1977 # },
1978 #
1979 # alt paper arms=4 diagonal, arms=8 x axis
1980 # A127988 # base 8 digits 0,4 only
1981 };
1982 }
1983 { package Math::PlanePath::AlternatePaperMidpoint;
1984 use constant _NumSeq_X_axis_increasing => 1;
1985 use constant _NumSeq_Y_axis_increasing => 1;
1986 use constant _NumSeq_Diagonal_increasing => 1;
1987 use constant _NumSeq_Diagonal_NW_increasing => 1; # arms
1988 use constant _NumSeq_Diagonal_SE_increasing => 1; # arms
1989 }
1990 # { package Math::PlanePath::TerdragonCurve;
1991 # }
1992 # { package Math::PlanePath::TerdragonRounded;
1993 # }
1994 # { package Math::PlanePath::TerdragonMidpoint;
1995 # }
1996 # { package Math::PlanePath::AlternateTerdragon;
1997 # }
1998 # { package Math::PlanePath::R5DragonCurve;
1999 # }
2000 # { package Math::PlanePath::R5DragonMidpoint;
2001 # }
2002 # { package Math::PlanePath::CCurve;
2003 # }
2004 # { package Math::PlanePath::ComplexPlus;
2005 # }
2006 { package Math::PlanePath::ComplexMinus;
2007 use constant _NumSeq_N_oeis_anum =>
2008 { 'realpart=1' =>
2009 { X_axis => 'A066321', # binary base i-1
2010 X_neg => 'A256441', # binary base i-1
2011 # OEIS-Catalogue: A066321 planepath=ComplexMinus
2012 # OEIS-Catalogue: A256441 planepath=ComplexMinus line_type=X_neg
2013 # cf A066323 count of 1-bits in N on X axis
2014 },
2015 };
2016 }
2017 # { package Math::PlanePath::ComplexRevolving;
2018 # }
2019 { package Math::PlanePath::Rows;
2020 use constant _NumSeq_X_axis_increasing => 1;
2021 use constant _NumSeq_Y_axis_increasing => 1;
2022 use constant _NumSeq_Diagonal_increasing => 1;
2023 use constant _NumSeq_Y_neg_min => undef; # negatives
2024 use constant _NumSeq_Y_neg_max => 1; # negatives
2025  
2026 # secret negatives
2027 # (w-1)*(w-1)-1
2028 # = w^2-2w+1-1
2029 # = w(w-2)
2030 sub _NumSeq_Diagonal_SE_min {
2031 my ($self) = @_;
2032 return ($self->{'width'}-2)*$self->{'width'};
2033 }
2034  
2035 use constant _NumSeq_N_oeis_anum =>
2036 {
2037 'n_start=0,width=1' =>
2038 { Y_axis => 'A001477', # integers 0,1,2,3,etc
2039 # OEIS-Other: A001477 planepath=Rows,width=1,n_start=0 line_type=Y_axis
2040 },
2041 'n_start=1,width=2' =>
2042 { Y_axis => 'A005408', # odd 2n+1
2043 # OEIS-Other: A005408 planepath=Rows,width=2 line_type=Y_axis
2044 },
2045 'n_start=1,width=3' =>
2046 { Y_axis => 'A016777', # 3n+1
2047 # OEIS-Catalogue: A016777 planepath=Rows,width=3 line_type=Y_axis
2048 },
2049 'n_start=1,width=4' =>
2050 { Y_axis => 'A016813', # 4n+1
2051 # OEIS-Catalogue: A016813 planepath=Rows,width=4 line_type=Y_axis
2052 },
2053  
2054 'n_start=1,width=5' =>
2055 { Y_axis => 'A016861', # 5n+1
2056 # OEIS-Catalogue: A016861 planepath=Rows,width=5 line_type=Y_axis
2057 },
2058 'n_start=1,width=6' =>
2059 { Y_axis => 'A016921', # 6n+1
2060 # OEIS-Catalogue: A016921 planepath=Rows,width=6 line_type=Y_axis
2061 },
2062 'n_start=1,width=7' =>
2063 { Y_axis => 'A016993', # 7n+1
2064 # OEIS-Catalogue: A016993 planepath=Rows,width=7 line_type=Y_axis
2065 },
2066 };
2067 }
2068 { package Math::PlanePath::Columns;
2069 use constant _NumSeq_X_axis_increasing => 1;
2070 use constant _NumSeq_Y_axis_increasing => 1;
2071 use constant _NumSeq_Diagonal_increasing => 1;
2072 use constant _NumSeq_X_neg_min => undef; # negatives
2073 use constant _NumSeq_X_neg_max => 1; # negatives
2074  
2075 sub _NumSeq_Diagonal_NW_min {
2076 my ($self) = @_;
2077 # secret negatives
2078 return ($self->{'height'}-2)*$self->{'height'};
2079 }
2080 use constant _NumSeq_N_oeis_anum =>
2081 {
2082 'n_start=0,height=1' =>
2083 { X_axis => 'A001477', # integers 0,1,2,3,etc
2084 # OEIS-Other: A001477 planepath=Columns,height=1,n_start=0
2085 },
2086 'n_start=1,height=2' =>
2087 { X_axis => 'A005408', # odd 2n+1
2088 # OEIS-Other: A005408 planepath=Columns,height=2
2089 },
2090 'n_start=1,height=3' =>
2091 { X_axis => 'A016777', # 3n+1
2092 # OEIS-Other: A016777 planepath=Columns,height=3
2093 },
2094 'n_start=1,height=4' =>
2095 { X_axis => 'A016813', # 4n+1
2096 # OEIS-Other: A016813 planepath=Columns,height=4
2097 },
2098 'n_start=1,height=5' =>
2099 { X_axis => 'A016861', # 5n+1
2100 # OEIS-Other: A016861 planepath=Columns,height=5
2101 },
2102 'n_start=1,height=6' =>
2103 { X_axis => 'A016921', # 6n+1
2104 # OEIS-Other: A016921 planepath=Columns,height=6
2105 },
2106 'n_start=1,height=7' =>
2107 { X_axis => 'A016993', # 7n+1
2108 # OEIS-Other: A016993 planepath=Columns,height=7
2109 },
2110 };
2111 }
2112 { package Math::PlanePath::Diagonals;
2113 use constant _NumSeq_X_axis_increasing => 1;
2114 use constant _NumSeq_Y_axis_increasing => 1;
2115 use constant _NumSeq_Diagonal_increasing => 1;
2116  
2117 use constant _NumSeq_N_oeis_anum =>
2118 { 'direction=down,n_start=1,x_start=0,y_start=0' =>
2119 {
2120 # Diagonals X_axis -- triangular 1,3,6,etc, but starting i=0 value=1
2121 Y_axis => 'A000124', # triangular+1 = n*(n+1)/2+1
2122 Diagonal => 'A001844', # centred squares 2n(n+1)+1
2123 # OEIS-Catalogue: A000124 planepath=Diagonals line_type=Y_axis
2124 # OEIS-Catalogue: A001844 planepath=Diagonals line_type=Diagonal
2125 },
2126 'direction=up,n_start=1,x_start=0,y_start=0' =>
2127 {
2128 X_axis => 'A000124', # triangular+1 = n*(n+1)/2+1
2129 Diagonal => 'A001844', # centred squares 2n(n+1)+1
2130 # OEIS-Other: A000124 planepath=Diagonals,direction=up
2131 # OEIS-Other: A001844 planepath=Diagonals,direction=up line_type=Diagonal
2132 },
2133  
2134 'direction=down,n_start=0,x_start=0,y_start=0' =>
2135 {
2136 X_axis => 'A000096', # n*(n+3)/2
2137 Y_axis => 'A000217', # triangular n*(n+1)/2
2138 # OEIS-Other: A000096 planepath=Diagonals,n_start=0
2139 # OEIS-Other: A000217 planepath=Diagonals,n_start=0 line_type=Y_axis
2140 },
2141 'direction=up,n_start=0,x_start=0,y_start=0' =>
2142 {
2143 X_axis => 'A000217', # triangular n*(n+1)/2
2144 Y_axis => 'A000096', # n*(n+3)/2
2145 # OEIS-Other: A000217 planepath=Diagonals,direction=up,n_start=0
2146 # OEIS-Other: A000096 planepath=Diagonals,direction=up,n_start=0 line_type=Y_axis
2147 },
2148 };
2149 }
2150 { package Math::PlanePath::DiagonalsAlternating;
2151 use constant _NumSeq_X_axis_increasing => 1;
2152 use constant _NumSeq_Y_axis_increasing => 1;
2153 use constant _NumSeq_Diagonal_increasing => 1;
2154  
2155 use constant _NumSeq_N_oeis_anum =>
2156 { 'n_start=1' =>
2157 { Diagonal => 'A001844', # centred squares 2n(n+1)+1
2158 # OEIS-Other: A001844 planepath=DiagonalsAlternating line_type=Diagonal
2159  
2160 # Not quite, extra initial 1 or 0
2161 # X_axis => 'A128918',
2162 # Y_axis => 'A131179',
2163 },
2164 'n_start=0' =>
2165 { Diagonal => 'A046092', # 2*triangular
2166 # OEIS-Other: A046092 planepath=DiagonalsAlternating,n_start=0 line_type=Diagonal
2167 },
2168 };
2169 }
2170 { package Math::PlanePath::DiagonalsOctant;
2171 use constant _NumSeq_X_axis_increasing => 1;
2172 use constant _NumSeq_Y_axis_increasing => 1;
2173 use constant _NumSeq_Diagonal_increasing => 1;
2174  
2175 use constant _NumSeq_N_oeis_anum =>
2176 {
2177 # 'direction=down,n_start=1' =>
2178 # {
2179 # Not quite, starting i=0 for square=1 cf A000290 starts 0
2180 # # Diagonal => 'A000290', # squares
2181 #
2182 # Not quite, A033638 extra initial 1
2183 # # Y_axis => 'A033638', # quarter squares + 1, 1,1,2,3,5,7,10,13
2184 # }
2185  
2186 # 'direction=up,n_start=1' =>
2187 # {
2188 # # Not quite, A002061 extra initial 1
2189 # # Diagonal => 'A002061', # 1,1,3,7,13,21,31,43
2190 # }
2191  
2192 'direction=down,n_start=0' =>
2193 { Diagonal => 'A005563', # n*(n+2) 0,3,8,15,24
2194 # OEIS-Other: A005563 planepath=DiagonalsOctant,n_start=0 line_type=Diagonal
2195  
2196 # # Not quite, extra initial 0
2197 # # Y_axis => 'A002620', # quarter squares 0,0,1,2,4,6,9,12,
2198 },
2199  
2200 'direction=up,n_start=0' =>
2201 { Diagonal => 'A002378', # pronic 0,2,6,12,20
2202 # OEIS-Other: A002378 planepath=DiagonalsOctant,direction=up,n_start=0 line_type=Diagonal
2203  
2204 # # Not quite, starts n=1 value=0 whereas start Y=0 value=0 here
2205 # # Y_axis => 'A024206', # 0,1,3,5,8,11,15
2206 },
2207 };
2208 }
2209 { package Math::PlanePath::MPeaks;
2210 use constant _NumSeq_X_axis_increasing => 1;
2211 use constant _NumSeq_Y_axis_increasing => 1;
2212 use constant _NumSeq_X_neg_increasing => 0;
2213 use constant _NumSeq_X_neg_increasing_from_i => 1;
2214 use constant _NumSeq_X_neg_min => 1; # at X=-1,Y=0 rather than X=0,Y=0
2215 use constant _NumSeq_Diagonal_increasing => 1;
2216 use constant _NumSeq_Diagonal_NW_increasing_from_i => 1;
2217 use constant _NumSeq_Diagonal_NW_min => 2; # at X=-1,Y=1
2218  
2219 # MPeaks -- X_axis A045944 matchstick n(3n+2) but initial N=3
2220 # MPeaks -- Diagonal,Y_axis hexagonal first,second spoke, but starting
2221 # from 3
2222 }
2223 { package Math::PlanePath::Staircase;
2224 use constant _NumSeq_X_axis_increasing => 1;
2225 use constant _NumSeq_Diagonal_increasing => 1;
2226  
2227 use constant _NumSeq_N_oeis_anum =>
2228 {
2229 'n_start=1' =>
2230 { Diagonal => 'A084849',
2231 # OEIS-Other: A084849 planepath=Staircase line_type=Diagonal
2232 },
2233  
2234 'n_start=0' =>
2235 { Diagonal => 'A014105', # second hexagonals
2236 # OEIS-Other: A014105 planepath=Staircase,n_start=0 line_type=Diagonal
2237 },
2238  
2239 'n_start=2' =>
2240 { Diagonal => 'A096376',
2241 # OEIS-Catalogue: A096376 planepath=Staircase,n_start=2 line_type=Diagonal
2242  
2243 # Not quite, A128918 has extra initial 1,1
2244 # X_axis => 'A128918',
2245 },
2246 };
2247 }
2248 { package Math::PlanePath::StaircaseAlternating;
2249 sub _NumSeq_X_axis_increasing {
2250 my ($self) = @_;
2251 return ($self->{'end_type'} eq 'square'
2252 ? 1
2253 : 0); # backs-up
2254 }
2255 *_NumSeq_Y_axis_increasing = \&_NumSeq_X_axis_increasing;
2256 use constant _NumSeq_Diagonal_increasing => 1;
2257  
2258 use constant _NumSeq_N_oeis_anum =>
2259 {
2260 'end_type=jump,n_start=1' =>
2261 { Diagonal => 'A084849',
2262 # OEIS-Other: A084849 planepath=StaircaseAlternating line_type=Diagonal
2263 },
2264 'end_type=jump,n_start=0' =>
2265 { Diagonal => 'A014105', # second hexagonals
2266 # OEIS-Other: A014105 planepath=StaircaseAlternating,n_start=0 line_type=Diagonal
2267 },
2268 'end_type=jump,n_start=2' =>
2269 { Diagonal => 'A096376',
2270 # OEIS-Other: A096376 planepath=StaircaseAlternating,n_start=2 line_type=Diagonal
2271 },
2272  
2273 'end_type=square,n_start=1' =>
2274 { Diagonal => 'A058331',
2275 # OEIS-Other: A058331 planepath=StaircaseAlternating,end_type=square line_type=Diagonal
2276 },
2277 'end_type=square,n_start=0' =>
2278 { Diagonal => 'A001105',
2279 # OEIS-Other: A001105 planepath=StaircaseAlternating,end_type=square,n_start=0 line_type=Diagonal
2280 },
2281 };
2282 }
2283 { package Math::PlanePath::Corner;
2284 use constant _NumSeq_X_axis_increasing => 1;
2285 use constant _NumSeq_Y_axis_increasing => 1;
2286 use constant _NumSeq_Diagonal_increasing => 1;
2287  
2288 use constant _NumSeq_N_oeis_anum =>
2289 { 'wider=0,n_start=1' =>
2290 { Y_axis => 'A002522', # n^2+1
2291 # OEIS-Other: A002522 planepath=Corner line_type=Y_axis
2292 },
2293 'wider=0,n_start=0' =>
2294 { X_axis => 'A005563', # (n+1)^2-1
2295 Y_axis => 'A000290', # squares
2296 Diagonal => 'A002378', # pronic
2297 # OEIS-Other: A005563 planepath=Corner,n_start=0
2298 # OEIS-Other: A000290 planepath=Corner,n_start=0 line_type=Y_axis
2299 # OEIS-Other: A002378 planepath=Corner,n_start=0 line_type=Diagonal
2300 },
2301 'wider=0,n_start=2' =>
2302 { Y_axis => 'A059100', # n^2+2
2303 Diagonal => 'A014206', # pronic+2
2304 # OEIS-Catalogue: A059100 planepath=Corner,n_start=2 line_type=Y_axis
2305 # OEIS-Catalogue: A014206 planepath=Corner,n_start=2 line_type=Diagonal
2306 },
2307  
2308 'wider=1,n_start=0' =>
2309 { Y_axis => 'A002378', # pronic
2310 Diagonal => 'A005563', # (n+1)^2-1
2311 # OEIS-Other: A002378 planepath=Corner,wider=1,n_start=0 line_type=Y_axis
2312 # OEIS-Other: A005563 planepath=Corner,wider=1,n_start=0 line_type=Diagonal
2313 },
2314 'wider=1,n_start=2' =>
2315 { Y_axis => 'A014206', # pronic+2
2316 # OEIS-Other: A014206 planepath=Corner,wider=1,n_start=2 line_type=Y_axis
2317 },
2318  
2319 'wider=2,n_start=0' =>
2320 { Y_axis => 'A005563', # (n+1)^2-1
2321 Diagonal => 'A028552', # n(n+3)
2322 # OEIS-Other: A005563 planepath=Corner,wider=2,n_start=0 line_type=Y_axis
2323 # OEIS-Catalogue: A028552 planepath=Corner,wider=2,n_start=0 line_type=Diagonal
2324 },
2325 'wider=2,n_start=1' =>
2326 { Diagonal => 'A028387', # n(n+3)+1 = n + (n+1)^2
2327 # OEIS-Catalogue: A028387 planepath=Corner,wider=2,n_start=1 line_type=Diagonal
2328 },
2329  
2330 'wider=3,n_start=0' =>
2331 { Y_axis => 'A028552', # n(n+3)
2332 # OEIS-Other: A028552 planepath=Corner,wider=3,n_start=0 line_type=Y_axis
2333 },
2334 };
2335 }
2336 { package Math::PlanePath::PyramidRows;
2337 use constant _NumSeq_Y_axis_increasing => 1;
2338 use constant _NumSeq_Diagonal_increasing => 1; # when covered, or single
2339 use constant _NumSeq_Diagonal_NW_increasing => 1;
2340  
2341 use constant _NumSeq_N_oeis_anum =>
2342 {
2343 # PyramidRows step=1
2344 do {
2345 my $href =
2346 { Y_axis => 'A000124', # triangular+1 = n*(n+1)/2+1
2347 };
2348 ('step=1,align=centre,n_start=1' => $href,
2349 'step=1,align=right,n_start=1' => $href);
2350  
2351 # OEIS-Other: A000124 planepath=PyramidRows,step=1 line_type=Y_axis
2352 # OEIS-Other: A000124 planepath=PyramidRows,step=1,align=right line_type=Y_axis
2353 },
2354 'step=1,align=left,n_start=1' =>
2355 { Diagonal_NW => 'A000124', # triangular+1 = n*(n+1)/2+1
2356 # OEIS-Other: A000124 planepath=PyramidRows,step=1,align=left line_type=Diagonal_NW
2357 },
2358 do {
2359 my $href =
2360 { Y_axis => 'A000217', # triangular
2361 };
2362 ('step=1,align=centre,n_start=0' => $href,
2363 'step=1,align=right,n_start=0' => $href);
2364  
2365 # OEIS-Other: A000217 planepath=PyramidRows,step=1,n_start=0 line_type=Y_axis
2366 # OEIS-Other: A000217 planepath=PyramidRows,step=1,align=right,n_start=0 line_type=Y_axis
2367 },
2368  
2369 'step=2,align=centre,n_start=1' =>
2370 { Diagonal_NW => 'A002522', # n^2+1
2371 # OEIS-Other: A002522 planepath=PyramidRows,step=2 line_type=Diagonal_NW
2372  
2373 # Not quite, n_start=1 means squares starting from 1 whereas A000290
2374 # starts from 0
2375 # Diagonal => 'A000290',
2376 },
2377 'step=2,align=centre,n_start=0' =>
2378 { Y_axis => 'A002378', # pronic
2379 Diagonal => 'A005563',
2380 Diagonal_NW => 'A000290', # squares
2381 # OEIS-Other: A002378 planepath=PyramidRows,step=2,n_start=0 line_type=Y_axis
2382 # OEIS-Other: A005563 planepath=PyramidRows,step=2,n_start=0 line_type=Diagonal
2383 # OEIS-Other: A000290 planepath=PyramidRows,step=2,n_start=0 line_type=Diagonal_NW
2384 },
2385 'step=2,align=right,n_start=0' =>
2386 { Y_axis => 'A000290', # squares
2387 Diagonal => 'A002378', # pronic
2388 # OEIS-Other: A000290 planepath=PyramidRows,step=2,align=right,n_start=0 line_type=Y_axis
2389 # OEIS-Other: A002378 planepath=PyramidRows,step=2,align=right,n_start=0 line_type=Diagonal
2390 },
2391 'step=2,align=left,n_start=0' =>
2392 { Y_axis => 'A005563',
2393 Diagonal_NW => 'A002378', # pronic
2394 # OEIS-Other: A005563 planepath=PyramidRows,step=2,align=left,n_start=0 line_type=Y_axis
2395 # OEIS-Other: A002378 planepath=PyramidRows,step=2,align=left,n_start=0 line_type=Diagonal_NW
2396 },
2397 'step=2,align=centre,n_start=2' =>
2398 { Diagonal_NW => 'A059100', # n^2+2
2399 # OEIS-Other: A059100 planepath=PyramidRows,step=2,n_start=2 line_type=Diagonal_NW
2400 },
2401 'step=2,align=right,n_start=2' =>
2402 { Y_axis => 'A059100', # n^2+2
2403 # OEIS-Other: A059100 planepath=PyramidRows,step=2,align=right,n_start=2 line_type=Y_axis
2404 },
2405  
2406 'step=3,align=centre,n_start=1' =>
2407 { Y_axis => 'A104249',
2408 Diagonal_NW => 'A143689',
2409 # OEIS-Catalogue: A104249 planepath=PyramidRows,step=3 line_type=Y_axis
2410 # OEIS-Catalogue: A143689 planepath=PyramidRows,step=3 line_type=Diagonal_NW
2411 # Not quite OFFSET=1 cf start i=0 here
2412 # Diagonal => 'A005448',
2413 # # OEIS-Catalogue: A005448 planepath=PyramidRows,step=3 line_type=Diagonal
2414 },
2415 'step=3,align=right,n_start=1' =>
2416 { Y_axis => 'A143689',
2417 Diagonal => 'A104249',
2418 # OEIS-Other: A143689 planepath=PyramidRows,step=3,align=right line_type=Y_axis
2419 # OEIS-Other: A104249 planepath=PyramidRows,step=3,align=right line_type=Diagonal
2420  
2421 # Not quite OFFSET=1 cf start i=0 here
2422 # Diagonal => 'A005448',
2423 # # OEIS-Catalogue: A005448 planepath=PyramidRows,step=3 line_type=Diagonal
2424 },
2425 'step=3,align=centre,n_start=0' =>
2426 { Y_axis => 'A005449', # second pentagonal n*(3n+1)/2
2427 Diagonal_NW => 'A000326', # pentagonal n(3n-1)/2
2428 # OEIS-Other: A005449 planepath=PyramidRows,step=3,n_start=0 line_type=Y_axis
2429 # OEIS-Other: A000326 planepath=PyramidRows,step=3,n_start=0 line_type=Diagonal_NW
2430 },
2431 'step=3,align=right,n_start=0' =>
2432 { Y_axis => 'A000326', # pentagonal n(3n-1)/2
2433 Diagonal => 'A005449', # second pentagonal n*(3n+1)/2
2434 # OEIS-Other: A000326 planepath=PyramidRows,step=3,align=right,n_start=0 line_type=Y_axis
2435 # OEIS-Other: A005449 planepath=PyramidRows,step=3,align=right,n_start=0 line_type=Diagonal
2436 },
2437  
2438 'step=4,align=centre,n_start=1' =>
2439 { Y_axis => 'A084849',
2440 Diagonal => 'A001844',
2441 Diagonal_NW => 'A058331',
2442 # OEIS-Catalogue: A084849 planepath=PyramidRows,step=4 line_type=Y_axis
2443 # OEIS-Other: A001844 planepath=PyramidRows,step=4 line_type=Diagonal
2444 # OEIS-Other: A058331 planepath=PyramidRows,step=4 line_type=Diagonal_NW
2445 },
2446 'step=4,align=right,n_start=1' =>
2447 { Diagonal => 'A058331',
2448 # OEIS-Other: A058331 planepath=PyramidRows,step=4,align=right line_type=Diagonal
2449 },
2450 'step=4,align=left,n_start=1' =>
2451 { Diagonal_NW => 'A001844',
2452 # OEIS-Other: A001844 planepath=PyramidRows,step=4,align=left line_type=Diagonal_NW
2453 },
2454 'step=4,align=centre,n_start=0' =>
2455 { Y_axis => 'A014105', # second hexagonal
2456 Diagonal => 'A046092', # 4*triangular
2457 Diagonal_NW => 'A001105', # 2*n^2
2458 # OEIS-Other: A014105 planepath=PyramidRows,step=4,n_start=0 line_type=Y_axis
2459 # OEIS-Catalogue: A046092 planepath=PyramidRows,step=4,n_start=0 line_type=Diagonal
2460 # OEIS-Other: A001105 planepath=PyramidRows,step=4,n_start=0 line_type=Diagonal_NW
2461 },
2462 'step=4,align=right,n_start=0' =>
2463 { Y_axis => 'A000384', # 2*n^2-n, hexagonal numbers
2464 Diagonal => 'A001105',
2465 # OEIS-Other: A000384 planepath=PyramidRows,step=4,align=right,n_start=0 line_type=Y_axis
2466 # OEIS-Other: A001105 planepath=PyramidRows,step=4,align=right,n_start=0 line_type=Diagonal
2467 },
2468 'step=4,align=left,n_start=0' =>
2469 { Diagonal_NW => 'A046092', # 4*triangular
2470 # OEIS-Other: A046092 planepath=PyramidRows,step=4,align=left,n_start=0 line_type=Diagonal_NW
2471 },
2472  
2473 # TODO PyramidRows,step=5 n_start=0
2474  
2475 'step=5,align=centre,n_start=1' =>
2476 { Y_axis => 'A116668',
2477 # OEIS-Other: A116668 planepath=PyramidRows,step=5 line_type=Y_axis
2478 },
2479 'step=6,align=centre,n_start=1' =>
2480 { Diagonal_NW => 'A056107',
2481 Y_axis => 'A056108',
2482 Diagonal => 'A056109',
2483 # OEIS-Other: A056107 planepath=PyramidRows,step=6 line_type=Diagonal_NW
2484 # OEIS-Other: A056108 planepath=PyramidRows,step=6 line_type=Y_axis
2485 # OEIS-Other: A056109 planepath=PyramidRows,step=6 line_type=Diagonal
2486 },
2487 'step=8,align=centre,n_start=1' =>
2488 { Diagonal_NW => 'A053755',
2489 # OEIS-Other: A053755 planepath=PyramidRows,step=8 line_type=Diagonal_NW
2490 },
2491 'step=9,align=centre,n_start=1' =>
2492 { Y_axis => 'A006137',
2493 Diagonal => 'A038764',
2494 # OEIS-Other: A006137 planepath=PyramidRows,step=9 line_type=Y_axis
2495 # OEIS-Other: A038764 planepath=PyramidRows,step=9 line_type=Diagonal
2496 },
2497 };
2498 }
2499 { package Math::PlanePath::PyramidSides;
2500 use constant _NumSeq_X_axis_increasing => 1;
2501 use constant _NumSeq_Y_axis_increasing => 1;
2502 use constant _NumSeq_X_neg_increasing => 1;
2503 use constant _NumSeq_Diagonal_increasing => 1;
2504 use constant _NumSeq_Diagonal_NW_increasing => 1;
2505  
2506 use constant _NumSeq_N_oeis_anum =>
2507 { 'n_start=1' =>
2508 { X_neg => 'A002522',
2509 Diagonal => 'A033951',
2510 # OEIS-Catalogue: A002522 planepath=PyramidSides line_type=X_neg
2511 # OEIS-Other: A033951 planepath=PyramidSides line_type=Diagonal
2512 #
2513 # X_axis -- squares (x+1)^2, but starting i=0 value=1
2514 } };
2515 }
2516 { package Math::PlanePath::CellularRule;
2517 use constant _NumSeq_Y_axis_increasing => 1;
2518 use constant _NumSeq_Diagonal_increasing => 1;
2519 use constant _NumSeq_Diagonal_NW_increasing => 1;
2520  
2521 use constant _NumSeq_N_oeis_anum =>
2522 { 'rule=5,n_start=1' =>
2523 { Y_axis => 'A061925', # ceil(n^2/2)+1
2524 # OEIS-Catalogue: A061925 planepath=CellularRule,rule=5 line_type=Y_axis
2525 },
2526  
2527 # rule 84,116,212,244 two-wide right line
2528 do {
2529 my $tworight
2530 = { Diagonal => 'A005408', # odds 2n+1
2531 };
2532 ('rule=84,n_start=1' => $tworight,
2533 'rule=116,n_start=1' => $tworight,
2534 'rule=212,n_start=1' => $tworight,
2535 'rule=244,n_start=1' => $tworight,
2536 );
2537  
2538 # OEIS-Other: A005408 planepath=CellularRule,rule=84 line_type=Diagonal
2539 # OEIS-Other: A005408 planepath=CellularRule,rule=116 line_type=Diagonal
2540 # OEIS-Other: A005408 planepath=CellularRule,rule=212 line_type=Diagonal
2541 # OEIS-Other: A005408 planepath=CellularRule,rule=244 line_type=Diagonal
2542 },
2543 'rule=77,n_start=1' =>
2544 { Y_axis => 'A000124', # triangular+1
2545 # OEIS-Other: A000124 planepath=CellularRule,rule=77 line_type=Y_axis
2546 },
2547 'rule=177,n_start=1' =>
2548 { Diagonal => 'A000124', # triangular+1
2549 # OEIS-Other: A000124 planepath=CellularRule,rule=177 line_type=Diagonal
2550 },
2551 'rule=185,n_start=1' =>
2552 { Diagonal => 'A002522', # n^2+1
2553 # OEIS-Other: A002522 planepath=CellularRule,rule=185 line_type=Diagonal
2554 },
2555 'rule=189,n_start=1' =>
2556 { Y_axis => 'A002522', # n^2+1
2557 # OEIS-Other: A002522 planepath=CellularRule,rule=189 line_type=Y_axis
2558 },
2559 # PyramidRows step=1,align=left
2560 # OEIS-Other: A000124 planepath=CellularRule,rule=206 line_type=Diagonal_NW
2561 # OEIS-Other: A000124 planepath=CellularRule,rule=238 line_type=Diagonal_NW
2562  
2563 do {
2564 my $solidgapright
2565 = { Diagonal => 'A002522', # n^2+1
2566 };
2567 ('rule=209,n_start=1' => $solidgapright,
2568 'rule=241,n_start=1' => $solidgapright,
2569 );
2570 # OEIS-Other: A002522 planepath=CellularRule,rule=209 line_type=Diagonal
2571 # OEIS-Other: A002522 planepath=CellularRule,rule=241 line_type=Diagonal
2572 },
2573 'rule=29,n_start=1' =>
2574 { Y_axis => 'A000124', # triangular+1
2575 # OEIS-Other: A000124 planepath=CellularRule,rule=29 line_type=Y_axis
2576 },
2577 'rule=221,n_start=1' =>
2578 { Y_axis => 'A002522', # n^2+1
2579 # OEIS-Other: A002522 planepath=CellularRule,rule=221 line_type=Y_axis
2580 },
2581 'rule=229,n_start=1' =>
2582 { Y_axis => 'A002522', # n^2+1
2583 # OEIS-Other: A002522 planepath=CellularRule,rule=229 line_type=Y_axis
2584 },
2585 #
2586 # rule=13 Y axis
2587 #
2588 # rule=28,156
2589 # Y_axis => 'A002620', quarter squares floor(n^2/4) but diff start
2590 # Diagonal => 'A024206', quarter squares - 1, but diff start
2591 #
2592 # A000027 naturals integers 1 upwards, but OFFSET=1 cf start Y=0 here
2593 # # central column only
2594 # 'rule=4' =>
2595 # { Y_axis => 'A000027', # 1 upwards
2596 # # OEIS-Other: A000027 planepath=CellularRule,rule=4 line_type=Y_axis
2597 # },
2598 #
2599 # # right line only rule=16,24,48,56,80,88,112,120,144,152,176,184,208,216,240,248
2600 # Not quite A000027 OFFSET=1 vs start X=Y=0 here
2601 # 'rule=16' =>
2602 # { Y_axis => 'A000027', # 1 upwards
2603 # # OEIS-Other: A000027 planepath=CellularRule,rule=16 line_type=Diagonal
2604 # },
2605 };
2606 }
2607 {
2608 package Math::PlanePath::CellularRule::Line;
2609 use constant _NumSeq_Y_axis_increasing => 1;
2610 use constant _NumSeq_Diagonal_increasing => 1;
2611 use constant _NumSeq_Diagonal_NW_increasing => 1;
2612 }
2613 {
2614 package Math::PlanePath::CellularRule::OneTwo;
2615 use constant _NumSeq_Y_axis_increasing => 1;
2616 use constant _NumSeq_Diagonal_increasing => 1;
2617 use constant _NumSeq_Diagonal_NW_increasing => 1;
2618  
2619 # use constant _NumSeq_N_oeis_anum =>
2620 # { 'align=left,n_start=1' =>
2621 # {
2622 # Not quite, OFFSET=1 cf coordinate X=0 here
2623 # Diagonal_NW => 'A001651', # not divisible by 3
2624 # },
2625  
2626 # { 'align=right,n_start=1' =>
2627 # Not quite, A032766 0 or 1 mod 3, but it starts OFFSET=0 value=0
2628 # whereas path start 1,3,4,etc without initial 0
2629 # Diagonal => 'A032766',
2630 #
2631 # };
2632 }
2633 {
2634 package Math::PlanePath::CellularRule::Two;
2635 use constant _NumSeq_Y_axis_increasing => 1;
2636 use constant _NumSeq_Diagonal_increasing => 1;
2637 use constant _NumSeq_Diagonal_NW_increasing => 1;
2638  
2639 use constant _NumSeq_N_oeis_anum =>
2640 { 'align=right,n_start=1' =>
2641 { Diagonal => 'A005408', # odd 2n+1
2642 # OEIS-Other: A005408 planepath=CellularRule,rule=84 line_type=Diagonal
2643 },
2644 };
2645 }
2646 {
2647 package Math::PlanePath::CellularRule::OddSolid;
2648 # rule=50,58,114,122,178,179,186,242,250 pyramid every second point
2649  
2650 use constant _NumSeq_Y_axis_increasing => 1;
2651 use constant _NumSeq_Diagonal_increasing => 1;
2652 use constant _NumSeq_Diagonal_NW_increasing => 1;
2653  
2654 use constant _NumSeq_N_oeis_anum =>
2655 { 'n_start=1' =>
2656 { Diagonal_NW => 'A000124', # triangular+1
2657 # OEIS-Other: A000124 planepath=CellularRule,rule=50 line_type=Diagonal_NW
2658 # OEIS-Other: A000124 planepath=CellularRule,rule=58 line_type=Diagonal_NW
2659 # OEIS-Other: A000124 planepath=CellularRule,rule=114 line_type=Diagonal_NW
2660 # OEIS-Other: A000124 planepath=CellularRule,rule=122 line_type=Diagonal_NW
2661 # OEIS-Other: A000124 planepath=CellularRule,rule=178 line_type=Diagonal_NW
2662 # OEIS-Other: A000124 planepath=CellularRule,rule=179 line_type=Diagonal_NW
2663 # OEIS-Other: A000124 planepath=CellularRule,rule=186 line_type=Diagonal_NW
2664 # OEIS-Other: A000124 planepath=CellularRule,rule=242 line_type=Diagonal_NW
2665 # OEIS-Other: A000124 planepath=CellularRule,rule=250 line_type=Diagonal_NW
2666 #
2667 # Not quite, starts value=0
2668 # Diagonal => 'A000217', # triangular numbers but diff start
2669 },
2670 };
2671 }
2672 { package Math::PlanePath::CellularRule54;
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::CellularRule57;
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 { package Math::PlanePath::CellularRule190;
2683 use constant _NumSeq_Y_axis_increasing => 1;
2684 use constant _NumSeq_Diagonal_increasing => 1;
2685 use constant _NumSeq_Diagonal_NW_increasing => 1;
2686  
2687 use constant _NumSeq_N_oeis_anum =>
2688 { 'mirror=0,n_start=0' =>
2689 { Diagonal_NW => 'A006578', # triangular and quarter square
2690 # OEIS-Catalogue: A006578 planepath=CellularRule190,n_start=0 line_type=Diagonal_NW
2691 },
2692 'mirror=1,n_start=0' =>
2693 { Diagonal_NW => 'A006578', # triangular and quarter square
2694 # OEIS-Other: A006578 planepath=CellularRule190,mirror=1,n_start=0 line_type=Diagonal_NW
2695 },
2696 };
2697 }
2698 { package Math::PlanePath::UlamWarburton;
2699 use constant _NumSeq_X_axis_increasing => 1;
2700 use constant _NumSeq_Y_axis_increasing => 1;
2701 use constant _NumSeq_X_neg_increasing => 1;
2702 use constant _NumSeq_Y_neg_increasing => 1;
2703 use constant _NumSeq_Diagonal_increasing => 1;
2704 use constant _NumSeq_Diagonal_NW_increasing => 1;
2705 use constant _NumSeq_Diagonal_SW_increasing => 1;
2706 use constant _NumSeq_Diagonal_SE_increasing => 1;
2707  
2708 use constant _NumSeq_N_oeis_anum =>
2709 { 'parts=4,n_start=0' =>
2710 { Depth_start => 'A147562', # cells ON after n stages
2711 # OEIS-Catalogue: A147562 planepath=UlamWarburton,n_start=0 line_type=Depth_start
2712 },
2713 'parts=2,n_start=0' =>
2714 { Depth_start => 'A183060', # num cells ON, starting from 0
2715 X_axis => 'A183060', # X_axis == Depth_start
2716 # OEIS-Catalogue: A183060 planepath=UlamWarburton,parts=2,n_start=0 line_type=Depth_start
2717 # OEIS-Other: A183060 planepath=UlamWarburton,parts=2,n_start=0
2718 },
2719 'parts=1,n_start=1' =>
2720 { Depth_end => 'A151922', # num cells ON at end of depth=n
2721 Y_axis => 'A151922', # Y_axis == Depth_end
2722 # OEIS-Catalogue: A151922 planepath=UlamWarburton,parts=1,n_start=1 line_type=Depth_end
2723 # OEIS-Other: A151922 planepath=UlamWarburton,parts=1,n_start=1 line_type=Y_axis
2724 },
2725 };
2726 }
2727 { package Math::PlanePath::UlamWarburtonQuarter;
2728 use constant _NumSeq_X_axis_increasing => 1;
2729 use constant _NumSeq_Diagonal_increasing => 1;
2730  
2731 # low 10111=23 increment to 11000=24
2732 # 4^2*3+4*3^2+1*3^3 = 111 123
2733 # 4^3*3 = 192 150 +27 = 3^3
2734  
2735 use constant _NumSeq_N_oeis_anum =>
2736 { 'parts=1,n_start=1' =>
2737 { Depth_end => 'A151920', # 3^count1bits(n), OFFSET=0 1,2,5,6,9
2738 # OEIS-Catalogue: A151920 planepath=UlamWarburtonQuarter line_type=Depth_end
2739 },
2740 };
2741 }
2742 { package Math::PlanePath::CoprimeColumns;
2743 use constant _NumSeq_X_axis_increasing => 1;
2744 use constant _NumSeq_Diagonal_increasing => 1;
2745 use constant _NumSeq_Diagonal_X_offset => 1;
2746  
2747 # CoprimeColumns
2748 # X_axis => 'A002088', # cumulative totient but start X=1 value=0;
2749 # Diagonal A015614 cumulative-1 but start X=1 value=1
2750 }
2751 { package Math::PlanePath::DivisibleColumns;
2752 use constant _NumSeq_X_axis_increasing => 1;
2753 use constant _NumSeq_Diagonal_increasing => 1;
2754  
2755 # Not quite, X_axis => 'A006218' but path start X=1 cf OFFSET=0,
2756 # Not quite, Diagonal => 'A077597' but path start X=1 cf OFFSET=0
2757 }
2758 # { package Math::PlanePath::File;
2759 # # File points from a disk file
2760 # # FIXME: analyze points for min/max
2761 # }
2762 # { package Math::PlanePath::QuintetCurve;
2763 # }
2764 # { package Math::PlanePath::QuintetCentres;
2765 # # inherit QuintetCurve
2766 # }
2767 { package Math::PlanePath::CornerReplicate;
2768 use constant _NumSeq_X_axis_increasing => 1;
2769 use constant _NumSeq_Y_axis_increasing => 1;
2770 use constant _NumSeq_Diagonal_increasing => 1;
2771  
2772 use constant _NumSeq_N_oeis_anum =>
2773 { '' =>
2774 { X_axis => 'A000695', # base 4 digits 0,1 only
2775 Y_axis => 'A001196', # base 4 digits 0,3 only
2776 Diagonal => 'A062880', # base 4 digits 0,2 only
2777 # OEIS-Other: A000695 planepath=CornerReplicate
2778 # OEIS-Other: A001196 planepath=CornerReplicate line_type=Y_axis
2779 # OEIS-Other: A062880 planepath=CornerReplicate line_type=Diagonal
2780 },
2781 };
2782 }
2783 { package Math::PlanePath::DigitGroups;
2784 use constant _NumSeq_Diagonal_increasing => 1;
2785  
2786 use constant _NumSeq_N_oeis_anum =>
2787 { 'radix=2,i_start=1' =>
2788 { X_axis => 'A084471', # 0 -> 00 in binary, starting OFFSET=1
2789 # OEIS-Catalogue: A084471 planepath=DigitGroups,radix=2 i_start=1
2790 },
2791 };
2792 }
2793 { package Math::PlanePath::FibonacciWordFractal;
2794 use constant _NumSeq_X_axis_increasing => 1; # when touched
2795 use constant _NumSeq_Y_axis_increasing => 1; # when touched
2796 use constant _NumSeq_Diagonal_increasing => 1; # when touched
2797 }
2798 { package Math::PlanePath::LTiling;
2799 use constant _NumSeq_Diagonal_increasing => 1;
2800  
2801 use constant _NumSeq_N_oeis_anum =>
2802 { 'L_fill=middle' =>
2803 { Diagonal => 'A062880', # base 4 digits 0,2 only
2804 # OEIS-Other: A062880 planepath=LTiling line_type=Diagonal
2805 },
2806 };
2807 }
2808 { package Math::PlanePath::WythoffArray;
2809 use constant _NumSeq_X_axis_increasing => 1;
2810 use constant _NumSeq_Y_axis_increasing => 1;
2811 use constant _NumSeq_Diagonal_increasing => 1;
2812  
2813 use constant _NumSeq_N_oeis_anum =>
2814 {
2815 'x_start=1,y_start=1' =>
2816 { Y_axis => 'A003622', # spectrum of phi 1,4,6,9
2817 Diagonal => 'A020941', # diagonal, OFFSET=1
2818 # OEIS-Catalogue: A003622 planepath=WythoffArray,x_start=1,y_start=1 line_type=Y_axis
2819 # OEIS-Catalogue: A020941 planepath=WythoffArray,x_start=1,y_start=1 line_type=Diagonal
2820  
2821 # Y=1 every second => 'A005248', # every second Lucas number
2822 },
2823  
2824 # # Not quite, extra initial 0,1 in A000045 Fibonaccis
2825 # # X_axis => 'A000045',
2826 #
2827 # # Y=1 row X=0,2,4,etc => 'A005248', # every second Lucas number
2828 };
2829 }
2830 { package Math::PlanePath::WythoffPreliminaryTriangle;
2831 use constant _NumSeq_Y_axis_i_start => 1;
2832 use constant _NumSeq_Y_axis_increasing => 1;
2833 use constant _NumSeq_N_oeis_anum =>
2834 {
2835 '' =>
2836 { Y_axis => 'A173027',
2837 # OEIS-Other: A173027 planepath=WythoffPreliminaryTriangle line_type=Y_axis
2838 },
2839 };
2840 }
2841 { package Math::PlanePath::PowerArray;
2842 use constant _NumSeq_X_axis_increasing => 1;
2843 use constant _NumSeq_Y_axis_increasing => 1;
2844 use constant _NumSeq_Diagonal_increasing => 1;
2845  
2846 # cf Not quite A168183 non-multiples-of-9, A168186 non-multiples-of-12
2847 # are values on Y axis, except OFFSET=1 value=1, whereas path start Y=0
2848 # value=1
2849 use constant _NumSeq_N_oeis_anum =>
2850 { 'radix=2' =>
2851 { X_axis => 'A000079', # powers 2^X
2852 Y_axis => 'A005408', # odd 2n+1
2853 Diagonal => 'A014480', # (2n+1)*2^n starting n=0
2854 # OEIS-Other: A000079 planepath=PowerArray
2855 # OEIS-Other: A005408 planepath=PowerArray line_type=Y_axis
2856 # OEIS-Catalogue: A014480 planepath=PowerArray line_type=Diagonal
2857 },
2858 'radix=3' =>
2859 { X_axis => 'A000244', # powers 3^X
2860 # OEIS-Other: A000244 planepath=PowerArray,radix=3
2861 #
2862 # Not quite, OFFSET=1 cf path start Y=0
2863 # Y_axis => 'A001651', # non multiples of 3
2864 },
2865 'radix=4' =>
2866 { X_axis => 'A000302', # powers 4^X
2867 # OEIS-Other: A000302 planepath=PowerArray,radix=4
2868 },
2869 'radix=5' =>
2870 { X_axis => 'A000351', # powers 5^X
2871 # OEIS-Other: A000351 planepath=PowerArray,radix=5
2872 },
2873 'radix=10' =>
2874 { X_axis => 'A011557', # powers 10^X
2875 # OEIS-Other: A011557 planepath=PowerArray,radix=10
2876  
2877 # Not quite, A067251 OFFSET=1 value=1 whereas path Y=0 N=value=1
2878 # Y_axis => 'A067251', # no trailing 0 digits
2879 # # OEIS-Catalogue: A067251 planepath=PowerArray,radix=10 line_type=Y_axis
2880 },
2881 };
2882 }
2883  
2884 #------------------------------------------------------------------------------
2885 # Math-PlanePath-Toothpick
2886  
2887 { package Math::PlanePath::ToothpickTree;
2888  
2889 # X axis has N=0 or N=0,1 only, except for parts=octant axis at Y=1
2890 sub _NumSeq_X_axis_increasing {
2891 my ($self) = @_;
2892 return ($self->{'parts'} ne 'octant');
2893 }
2894  
2895 # Y axis has N=0,N=1 only, except for parts=octant_up axis at X=1
2896 sub _NumSeq_Y_axis_increasing {
2897 my ($self) = @_;
2898 return ($self->{'parts'} ne 'octant_up');
2899 }
2900 use constant _NumSeq_Y_neg_increasing => 1; # N=0,N=2 only
2901  
2902 use constant _NumSeq_Diagonal_increasing => 1; # growth steps along diags
2903 use constant _NumSeq_Diagonal_NW_increasing => 1;
2904 use constant _NumSeq_Diagonal_SE_increasing => 1;
2905 use constant _NumSeq_Diagonal_SW_increasing => 1;
2906  
2907 # catalogued in Math::NumSeq::OEIS::Catalogue::Plugin::PlanePathToothpick
2908 use constant _NumSeq_N_oeis_anum =>
2909 { 'parts=4' =>
2910 { Depth_start => 'A139250',
2911 # OEIS-Other: A139250 planepath=ToothpickTree,parts=4 line_type=Depth_start
2912 },
2913 'parts=3' =>
2914 { Depth_start => 'A153006',
2915 # OEIS-Other: A153006 planepath=ToothpickTree,parts=3 line_type=Depth_start
2916 },
2917 'parts=2' =>
2918 { Depth_start => 'A152998',
2919 # OEIS-Other: A152998 planepath=ToothpickTree,parts=2 line_type=Depth_start
2920 },
2921 'parts=1' =>
2922 { Depth_start => 'A153000',
2923 # OEIS-Other: A153000 planepath=ToothpickTree,parts=1 line_type=Depth_start
2924 },
2925 'parts=wedge' =>
2926 { Depth_start => 'A160406',
2927 # OEIS-Other: A160406 planepath=ToothpickTree,parts=wedge line_type=Depth_start
2928 },
2929 'parts=two_horiz' =>
2930 { Depth_start => 'A160158',
2931 # OEIS-Other: A160158 planepath=ToothpickTree,parts=two_horiz line_type=Depth_start
2932 },
2933 };
2934 }
2935 { package Math::PlanePath::ToothpickReplicate;
2936 use constant _NumSeq_Y_axis_increasing => 1; # N=0,N=1 only
2937  
2938 sub _NumSeq_Y_neg_increasing {
2939 my ($self) = @_;
2940 return ($self->{'parts'} == 3 ? 0 # replication twist
2941 : 1); # N=0,N=2 only
2942 }
2943 use constant _NumSeq_Diagonal_increasing => 1; # replicate along diags
2944 use constant _NumSeq_Diagonal_NW_increasing => 1;
2945 use constant _NumSeq_Diagonal_SE_increasing => 1;
2946 use constant _NumSeq_Diagonal_SW_increasing => 1;
2947 }
2948 { package Math::PlanePath::ToothpickUpist;
2949 use constant _NumSeq_Y_axis_increasing => 1; # rows increasing
2950 use constant _NumSeq_Diagonal_increasing => 1;
2951 use constant _NumSeq_Diagonal_NW_increasing => 1;
2952  
2953 # catalogued in Math::NumSeq::OEIS::Catalogue::Plugin::PlanePathToothpick
2954 use constant _NumSeq_N_oeis_anum =>
2955 { '' =>
2956 { Depth_start => 'A151566',
2957 # OEIS-Other: A151566 planepath=ToothpickUpist line_type=Depth_start
2958 },
2959 };
2960 }
2961 { package Math::PlanePath::ToothpickSpiral;
2962 use constant _NumSeq_X_axis_increasing => 1;
2963 use constant _NumSeq_Y_axis_increasing => 1;
2964 use constant _NumSeq_X_neg_increasing => 1;
2965 use constant _NumSeq_Diagonal_increasing => 1;
2966 use constant _NumSeq_Diagonal_NW_increasing => 1;
2967 use constant _NumSeq_Diagonal_SW_increasing => 1;
2968 use constant _NumSeq_Diagonal_SE_increasing => 1;
2969  
2970 # catalogued in Math::NumSeq::OEIS::Catalogue::Plugin::PlanePathToothpick
2971 use constant _NumSeq_N_oeis_anum =>
2972 { 'n_start=1' =>
2973 { Diagonal => 'A014634', # odd-index hexagonals
2974 Diagonal_NW => 'A033567', #
2975 Diagonal_SW => 'A185438', #
2976 Diagonal_SE => 'A188135', #
2977 # OEIS-Other: A014634 planepath=ToothpickSpiral line_type=Diagonal
2978 # OEIS-Other: A033567 planepath=ToothpickSpiral line_type=Diagonal_NW
2979 # OEIS-Other: A185438 planepath=ToothpickSpiral line_type=Diagonal_SW
2980 # OEIS-Other: A188135 planepath=ToothpickSpiral line_type=Diagonal_SE
2981 },
2982 'n_start=0' =>
2983 { Diagonal => 'A033587', #
2984 Diagonal_SW => 'A014635', # even-index hexagonals
2985 Diagonal_SE => 'A033585', #
2986 Diagonal_NW => 'A139271',
2987 # OEIS-Other: A033587 planepath=ToothpickSpiral,n_start=0 line_type=Diagonal
2988 # OEIS-Other: A014635 planepath=ToothpickSpiral,n_start=0 line_type=Diagonal_SW
2989 # OEIS-Other: A033585 planepath=ToothpickSpiral,n_start=0 line_type=Diagonal_SE
2990 # OEIS-Other: A139271 planepath=ToothpickSpiral,n_start=0 line_type=Diagonal_NW
2991 },
2992 };
2993 }
2994  
2995 { package Math::PlanePath::LCornerTree;
2996 sub _NumSeq_X_axis_increasing {
2997 my ($self) = @_;
2998 return $self->{'parts'} ne 'diagonal-1';
2999 }
3000  
3001 {
3002 my %_NumSeq_Y_axis_increasing = ('octant+1' => 1, # two points only
3003 'diagonal-1' => 1,
3004 );
3005 sub _NumSeq_Y_axis_increasing {
3006 my ($self) = @_;
3007 return $_NumSeq_Y_axis_increasing{$self->{'parts'}};
3008 }
3009 }
3010  
3011 sub _NumSeq_X_neg_increasing {
3012 my ($self) = @_;
3013 return ($self->{'parts'} eq 'wedge' # two points N=0,N=1
3014 || $self->{'parts'} eq 'wedge+1' # three points N=0,1,7
3015 || $self->{'parts'} eq 'diagonal');
3016 }
3017  
3018 # parts=diagonal has minimum N=0 at X=0,Y=-1, so explicit Y_neg minimum
3019 use constant _NumSeq_Y_neg_min => 0;
3020 sub _NumSeq_Y_neg_increasing {
3021 my ($self) = @_;
3022 return $self->{'parts'} ne 'diagonal';
3023 }
3024 use constant _NumSeq_Diagonal_increasing => 1; # growth along diags
3025 use constant _NumSeq_Diagonal_NW_increasing => 1;
3026 use constant _NumSeq_Diagonal_SE_increasing => 1;
3027 use constant _NumSeq_Diagonal_SW_increasing => 1;
3028  
3029 # catalogued in Math::NumSeq::OEIS::Catalogue::Plugin::PlanePathToothpick
3030 use constant _NumSeq_N_oeis_anum =>
3031 { 'parts=4' =>
3032 { Depth_start => 'A160410', # 4 * cumulative 3^count1bits(n)
3033 # OEIS-Other: A160410 planepath=LCornerTree line_type=Depth_start
3034 },
3035 'parts=3' =>
3036 { Depth_start => 'A160412', # 3 * cumulative 3^count1bits(n)
3037 # OEIS-Other: A160412 planepath=LCornerTree,parts=3 line_type=Depth_start
3038 },
3039 'parts=diagonal-1' =>
3040 { Depth_start => 'A183148', # half-plane triplet toothpicks
3041 # OEIS-Other: A183148 planepath=LCornerTree,parts=diagonal-1 line_type=Depth_start
3042  
3043 # No, N=1 start of depth=1 is at X=1,Y=0 not on SE diagonal
3044 # Diagonal_SE => 'A183148',
3045 },
3046  
3047 # Not quite, A130665=1,4,7,16 offset=0 whereas Nend=0,1,4,7,16 depth=0
3048 # has extra initial 0.
3049 # 'parts=1' =>
3050 # { Depth_end => 'A130665', # cumulative 3^count1bits(d), starting a(0)=1
3051 # # OEIS-Catalogue: A130665 planepath=LCornerTree,parts=1,n_start=-1 line_type=Depth_end i_offset=1
3052 # },
3053 };
3054 }
3055 { package Math::PlanePath::LCornerReplicate;
3056 use constant _NumSeq_X_axis_increasing => 1;
3057 use constant _NumSeq_Diagonal_increasing => 1; # replicate along diags
3058  
3059 # catalogued in Math::NumSeq::OEIS::Catalogue::Plugin::PlanePathToothpick
3060 use constant _NumSeq_N_oeis_anum =>
3061 { '' =>
3062 { Diagonal => 'A062880', # base 4 digits 0,2 only
3063 # OEIS-Other: A062880 planepath=LCornerReplicate line_type=Diagonal
3064 },
3065 };
3066 }
3067  
3068 { package Math::PlanePath::OneOfEight;
3069 use constant _NumSeq_X_axis_increasing => 1;
3070 use constant _NumSeq_X_neg_increasing => 1;
3071 use constant _NumSeq_Y_axis_increasing => 1;
3072 use constant _NumSeq_Y_neg_increasing => 1;
3073 use constant _NumSeq_Diagonal_increasing => 1;
3074 use constant _NumSeq_Diagonal_NW_increasing => 1;
3075 use constant _NumSeq_Diagonal_SW_increasing => 1;
3076 use constant _NumSeq_Diagonal_SE_increasing => 1;
3077  
3078 # catalogued in Math::NumSeq::OEIS::Catalogue::Plugin::PlanePathToothpick
3079 use constant _NumSeq_N_oeis_anum =>
3080 { 'parts=4' =>
3081 { Depth_start => 'A151725',
3082 # OEIS-Other: A151725 planepath=OneOfEight line_type=Depth_start
3083 },
3084 'parts=1' =>
3085 { Depth_start => 'A151735',
3086 # OEIS-Other: A151735 planepath=OneOfEight,parts=1 line_type=Depth_start
3087 },
3088 'parts=3mid' =>
3089 { Depth_start => 'A170880',
3090 # OEIS-Other: A170880 planepath=OneOfEight,parts=3mid line_type=Depth_start
3091 },
3092 'parts=3side' =>
3093 { Depth_start => 'A170879',
3094 # OEIS-Other: A170879 planepath=OneOfEight,parts=3side line_type=Depth_start
3095 },
3096 };
3097 }
3098  
3099 { package Math::PlanePath::HTree;
3100 # clockwise around each sub-tree so N increases along X axis
3101 use constant _NumSeq_X_axis_increasing => 1;
3102 }
3103  
3104 #------------------------------------------------------------------------------
3105 { package Math::PlanePath;
3106 use constant _NumSeq_A2 => 0;
3107 }
3108 { package Math::PlanePath::TriangleSpiral;
3109 use constant _NumSeq_A2 => 1;
3110 }
3111 { package Math::PlanePath::HexSpiral;
3112 use constant _NumSeq_A2 => 1;
3113 }
3114 { package Math::PlanePath::HexArms;
3115 use constant _NumSeq_A2 => 1;
3116 }
3117 { package Math::PlanePath::TriangularHypot;
3118 use constant _NumSeq_A2 => 1;
3119 }
3120 { package Math::PlanePath::Flowsnake;
3121 use constant _NumSeq_A2 => 1;
3122 # and FlowsnakeCentres inherits
3123 }
3124  
3125 1;
3126 __END__