OEIS/Cumulative counting: Difference between revisions

From tehowiki
Jump to navigation Jump to search
imported>Gfis
No edit summary
imported>Gfis
 
(3 intermediate revisions by the same user not shown)
Line 16: Line 16:
# Most b-files are rather short, though some sequences have quite a number of terms in common (e.g. 61, 82) before they start to differ.
# Most b-files are rather short, though some sequences have quite a number of terms in common (e.g. 61, 82) before they start to differ.
# [https://oeis.org/A030717 A030717] (row 1)  does not correspond with the derived sequences [https://oeis.org/A030718 A030718] (row 2) and A030719-A030726. A030717 initially had no zero terms, but in 2014 the description was changed, and the b-file now has zero terms. This should be changed back.
# [https://oeis.org/A030717 A030717] (row 1)  does not correspond with the derived sequences [https://oeis.org/A030718 A030718] (row 2) and A030719-A030726. A030717 initially had no zero terms, but in 2014 the description was changed, and the b-file now has zero terms. This should be changed back.
# [https://oeis.org/A030740 A030740] (inverse) has a strange <code>Offset 2,1</code> which should be 1,1 IMHO as for the similiar [https://oeis.org/A030730 A030730], [https://oeis.org/A030750 A030750]. In the description there is a typo <code>j'2</code>.
# [https://oeis.org/A030740 A030740] (inverse) has a strange <code>OFFSET 2,1</code> which should be 1,1 IMHO as for the similiar [https://oeis.org/A030730 A030730], [https://oeis.org/A030750 A030750]. In the description there is a typo <code>j'2</code>.
# A030709 = A030759, A030729 = A030779, A030749 = A030789, A030711 = A030761
# [https://oeis.org/A055186 A055186] should not carry KEYWORD <code>base</code>.
# [https://oeis.org/A055186 A055186] should not carry keyword <code>base</code>.
# In the example for [https://oeis.org/A055168 A055168], the last <code>3</code> should be a <code>4</code>.
# The example in [https://oeis.org/A055168 A055168] has a typo.
==List of ''cumulative counting'' sequences==
==List of ''cumulative counting'' sequences==
The list of 116 sequences below describes the variations. The list has the following entries (which are explained in more detail in the Perl program, below):
The list of more than 120 sequences below describes the variations. The list has the following entries (which are explained in more detail in the Perl program, below):
* the OEIS A-number,
* the OEIS A-number,
* a major rule name (A, B were defined by C. Kimberling)
* a major rule name (A, B were defined by C. Kimberling)
* the starting value s(1)
* the starting value s(1)
* a code for the ordering in the segements (increasing/decreasing order, first appearance)
* a code for the ordering in the segments (increasing/decreasing order, first appearance)
* a code for the row number (1, 2, ...)  
* a code for the row number (1, 2, ...)  
* optional parameters
* optional parameters
Line 151: Line 150:
  [http://oeis.org/A240508 A240508] T 0 io 5 with0=3
  [http://oeis.org/A240508 A240508] T 0 io 5 with0=3
  122 sequences
  122 sequences
==Symmetry and relations==
s    A 1      A 2      T        I        J        K        P 1      P 2      P 3      P 4
1  [http://oeis.org/A030707 A030707] [http://oeis.org/A030708 A030708] [http://oeis.org/A030709 A030709] [http://oeis.org/A030710 A030710] [http://oeis.org/A030711 A030711] [http://oeis.org/A030712 A030712] [http://oeis.org/A030713 A030713] [http://oeis.org/A030714 A030714] [http://oeis.org/A030715 A030715] [http://oeis.org/A030716 A030716] io
    [http://oeis.org/A030717 A030717] [http://oeis.org/A030718 A030718] [http://oeis.org/A030719 A030719] [http://oeis.org/A030720 A030720] [http://oeis.org/A030721 A030721] [http://oeis.org/A030722 A030722] [http://oeis.org/A030723 A030723] [http://oeis.org/A030724 A030724] [http://oeis.org/A030725 A030725] [http://oeis.org/A030726 A030726] io
3  [http://oeis.org/A030727 A030727] [http://oeis.org/A030728 A030728] [http://oeis.org/A030729 A030729] [http://oeis.org/A030730 A030730] [http://oeis.org/A030731 A030731] [http://oeis.org/A030732 A030732] [http://oeis.org/A030733 A030733] [http://oeis.org/A030734 A030734] [http://oeis.org/A030735 A030735] [http://oeis.org/A030736 A030736] io
2  [http://oeis.org/A030737 A030737] [http://oeis.org/A030738 A030738] [http://oeis.org/A030739 A030739] [http://oeis.org/A030740 A030740] [http://oeis.org/A030741 A030741] [http://oeis.org/A030742 A030742] [http://oeis.org/A030743 A030743] [http://oeis.org/A030744 A030744] [http://oeis.org/A030745 A030745] [http://oeis.org/A030746 A030746] io
4  [http://oeis.org/A030747 A030747] [http://oeis.org/A030748 A030748] [http://oeis.org/A030749 A030749] [http://oeis.org/A030750 A030750] [http://oeis.org/A030751 A030751] [http://oeis.org/A030752 A030752] [http://oeis.org/A030753 A030753] [http://oeis.org/A030754 A030754] [http://oeis.org/A030755 A030755] [http://oeis.org/A030756 A030756] io
   
1  [http://oeis.org/A030757 A030757] [http://oeis.org/A030758 A030758] [http://oeis.org/A030759 A030759] [http://oeis.org/A030760 A030760] [http://oeis.org/A030761 A030761] [http://oeis.org/A030762 A030762] [http://oeis.org/A030763 A030763] [http://oeis.org/A030764 A030764] [http://oeis.org/A030765 A030765] [http://oeis.org/A030766 A030766] do
2  [http://oeis.org/A030767 A030767] [http://oeis.org/A030768 A030768] [http://oeis.org/A030769 A030769] [http://oeis.org/A030770 A030770] [http://oeis.org/A030771 A030771] [http://oeis.org/A030772 A030772] [http://oeis.org/A030773 A030773] [http://oeis.org/A030774 A030774] [http://oeis.org/A030775 A030775] [http://oeis.org/A030776 A030776] do
3  [http://oeis.org/A030777 A030777] [http://oeis.org/A030778 A030778] [http://oeis.org/A030779 A030779] [http://oeis.org/A030780 A030780] [http://oeis.org/A030781 A030781] [http://oeis.org/A030782 A030782] [http://oeis.org/A030783 A030783] [http://oeis.org/A030784 A030784] [http://oeis.org/A030785 A030785] [http://oeis.org/A030786 A030786] do
4  [http://oeis.org/A030787 A030787] [http://oeis.org/A030788 A030788] [http://oeis.org/A030789 A030789] [http://oeis.org/A030790 A030790] [http://oeis.org/A030791 A030791] [http://oeis.org/A030792 A030792] [http://oeis.org/A030793 A030793] [http://oeis.org/A030794 A030794] [http://oeis.org/A030795 A030795] [http://oeis.org/A030796 A030796] do
s    B        N        D
0 [http://oeis.org/A055168 A055168] [http://oeis.org/A055169 A055169] [http://oeis.org/A055170 A055170] fa
1 [http://oeis.org/A055171 A055171] [http://oeis.org/A055172 A055172] [http://oeis.org/A055173 A055173] fa
2 [http://oeis.org/A055174 A055174] [http://oeis.org/A055175 A055175] [http://oeis.org/A055176 A055176] fa
3 [http://oeis.org/A055177 A055177] [http://oeis.org/A055178 A055178] [http://oeis.org/A055179 A055179] fa
4 [http://oeis.org/A055180 A055180] [http://oeis.org/A055181 A055181] [http://oeis.org/A055182 A055182] fa
5 [http://oeis.org/A055183 A055183] [http://oeis.org/A055184 A055184] [http://oeis.org/A055185 A055185] fa
The following relations can be observed:
1 A030709 = A030759 (segment lengths)
2 A030739 = A030769
3 A030729 = A030779
4 A030749 = A030789
1 A030711 = A030761 (next term which is greater than all previous)
==Generating Perl program==
==Generating Perl program==
The Perl program below can be used to generate all sequences of the list. It produces b-files, but the rules T, J, K are currently rather slow, and take time above 100 entries. The latest version of the program and its auxilliary files can be found on a [https://github.com/gfis/fasces/tree/master/oeis/A055187 Github repository].
The Perl program below can be used to generate all sequences of the list. It produces b-files, but the rules T, J, K are currently rather slow, and take time above 100 entries. The latest version of the program and its auxilliary files can be found on a [https://github.com/gfis/fasces/tree/master/oeis/A055187 Github repository].

Latest revision as of 17:25, 29 December 2021

Clark Kimberling defined - for example - in A217760:

Write 0 followed by segments defined inductively as follows: each segment
tells how many times each previously written integer occurs, in the order
of first occurrence.  This is Method A (adjective-before-noun pairs); for
Method B (noun-before-adjective), see A055168. 
Example:
Start with 0, followed by the adjective-noun pair 1,0; followed by
adjective-noun pairs 2,0 then 1,1; etc. Writing the pairs vertically,
the initial segments are
0.|.1.|.2 1.|.3 3 1.|.4 5 2 2.|.5 6 5 3 1 1.|.6 9 6 5 2 4 1.|.7 11 8 6 4 6 4 1
..|.0.|.0 1.|.0 1 2.|.0 1 2 3.|.0 1 2 3 4 5.|.0 1 2 3 4 5 6.|.0 1  2 3 4 5 6 9

Depending on the starting value s(1), with variations of the rules and derivations, there are more than 120 related sequences in the OEIS.

Results and Problems

A Perl program and a Unix makefile were written in order to evaluate these sequences. Only a few problems were found:

  1. The treatment of zero attributes and noun zero is not always clearly described, and the methods differ considerably with this respect.
  2. Most b-files are rather short, though some sequences have quite a number of terms in common (e.g. 61, 82) before they start to differ.
  3. A030717 (row 1) does not correspond with the derived sequences A030718 (row 2) and A030719-A030726. A030717 initially had no zero terms, but in 2014 the description was changed, and the b-file now has zero terms. This should be changed back.
  4. A030740 (inverse) has a strange OFFSET 2,1 which should be 1,1 IMHO as for the similiar A030730, A030750. In the description there is a typo j'2.
  5. A055186 should not carry KEYWORD base.
  6. In the example for A055168, the last 3 should be a 4.

List of cumulative counting sequences

The list of more than 120 sequences below describes the variations. The list has the following entries (which are explained in more detail in the Perl program, below):

  • the OEIS A-number,
  • a major rule name (A, B were defined by C. Kimberling)
  • the starting value s(1)
  • a code for the ordering in the segments (increasing/decreasing order, first appearance)
  • a code for the row number (1, 2, ...)
  • optional parameters
A030707 A 1 io 1
A030708 A 1 io 2
A030709 T 1 io 1
A030710 I 1 io 1
A030711 J 1 io 1
A030712 K 1 io 1
A030713 P 1 io 1 parm=1
A030714 P 1 io 1 parm=2
A030715 P 1 io 1 parm=3
A030716 P 1 io 1 parm=4
A030717 A 1 io 5 with0=3
A030718 A 1 io 6
A030719 T 1 io 5
A030720 I 1 io 5
A030721 J 1 io 5
A030722 K 1 io 5
A030723 P 1 io 5 parm=1
A030724 P 1 io 5 parm=2
A030725 P 1 io 5 parm=3
A030726 P 1 io 5 parm=4
A030727 A 3 io 1
A030728 A 3 io 2
A030729 T 3 io 3
A030730 I 3 io 1
A030731 J 3 io 1
A030732 K 3 io 1
A030733 P 3 io 1 parm=1
A030734 P 3 io 1 parm=2
A030735 P 3 io 1 parm=3
A030736 P 3 io 1 parm=4
A030737 A 2 io 1
A030738 A 2 io 2
A030739 T 2 io 3
A030740 I 2 io 1
A030741 J 2 io 1
A030742 K 2 io 1
A030743 P 2 io 1 parm=1
A030744 P 2 io 1 parm=2
A030745 P 2 io 1 parm=3
A030746 P 2 io 1 parm=4
A030747 A 4 io 1
A030748 A 4 io 2
A030749 T 4 io 3
A030750 I 4 io 1
A030751 J 4 io 1
A030752 K 4 io 1
A030753 P 4 io 1 parm=1
A030754 P 4 io 1 parm=2
A030755 P 4 io 1 parm=3
A030756 P 4 io 1 parm=4
A030757 A 1 do 1
A030758 A 1 do 2
A030759 T 1 do 3
A030760 I 1 do 1
A030761 J 1 do 1
A030762 K 1 do 1
A030763 P 1 do 1 parm=1
A030764 P 1 do 1 parm=2
A030765 P 1 do 1 parm=3
A030766 P 1 do 1 parm=4
A030767 A 2 do 1
A030768 A 2 do 2
A030769 T 2 do 3
A030770 I 2 do 1
A030771 J 2 do 1
A030772 K 2 do 1
A030773 P 2 do 1 parm=1
A030774 P 2 do 1 parm=2
A030775 P 2 do 1 parm=3
A030776 P 2 do 1 parm=4
A030777 A 3 do 1
A030778 A 3 do 2
A030779 T 3 do 3
A030780 I 3 do 1
A030781 J 3 do 1
A030782 K 3 do 1
A030783 P 3 do 1 parm=1
A030784 P 3 do 1 parm=2
A030785 P 3 do 1 parm=3
A030786 P 3 do 1 parm=4
A030787 A 4 do 1
A030788 A 4 do 2
A030789 T 4 do 3
A030790 I 4 do 1
A030791 J 4 do 1
A030792 K 4 do 1
A030793 P 4 do 1 parm=1
A030794 P 4 do 1 parm=2
A030795 P 4 do 1 parm=3
A030796 P 4 do 1 parm=4
A051120 A 1 do 3 offset=0 first=2
A055168 B 0 fa 3 with0=2
A055169 N 0 fa 3 with0=2
A055170 D 0 fa 2 with0=2
A055171 B 1 fa 3
A055172 N 1 fa 3
A055173 D 1 fa 2
A055174 B 2 fa 3
A055175 N 2 fa 3
A055176 D 2 fa 2
A055177 B 3 fa 3
A055178 N 3 fa 3
A055179 D 3 fa 2
A055180 B 4 fa 3
A055181 N 4 fa 3
A055182 D 4 fa 2
A055183 B 5 fa 3
A055184 N 5 fa 3
A055185 D 5 fa 2
A055186 A 0 io 3 with0=3
A055187 A 1 io 3 with0=2
A055188 A 2 fa 3
A055189 A 3 fa 3
A055190 A 4 fa 3
A055191 A 5 fa 3
A079668 A 1 io 3 first=2 with0=3
A079686 A 0 do 3 offset=0 with0=3
A126027 T 1 io 5 with0=3
A174382 A 0 io 5 with0=3
A217760 A 0 fa 3 with0=2
A217780 A 1 fa 3
A240508 T 0 io 5 with0=3
122 sequences

Symmetry and relations

s     A 1       A 2       T        I        J        K        P 1      P 2      P 3      P 4
1  A030707 A030708 A030709 A030710 A030711 A030712 A030713 A030714 A030715 A030716 io
   A030717 A030718 A030719 A030720 A030721 A030722 A030723 A030724 A030725 A030726 io
3  A030727 A030728 A030729 A030730 A030731 A030732 A030733 A030734 A030735 A030736 io
2  A030737 A030738 A030739 A030740 A030741 A030742 A030743 A030744 A030745 A030746 io
4  A030747 A030748 A030749 A030750 A030751 A030752 A030753 A030754 A030755 A030756 io
   
1  A030757 A030758 A030759 A030760 A030761 A030762 A030763 A030764 A030765 A030766 do
2  A030767 A030768 A030769 A030770 A030771 A030772 A030773 A030774 A030775 A030776 do
3  A030777 A030778 A030779 A030780 A030781 A030782 A030783 A030784 A030785 A030786 do
4  A030787 A030788 A030789 A030790 A030791 A030792 A030793 A030794 A030795 A030796 do

s     B        N        D
0 A055168 A055169 A055170 fa
1 A055171 A055172 A055173 fa
2 A055174 A055175 A055176 fa
3 A055177 A055178 A055179 fa
4 A055180 A055181 A055182 fa
5 A055183 A055184 A055185 fa

The following relations can be observed:

1 A030709 = A030759 (segment lengths)
2 A030739 = A030769
3 A030729 = A030779
4 A030749 = A030789 
1 A030711 = A030761 (next term which is greater than all previous)

Generating Perl program

The Perl program below can be used to generate all sequences of the list. It produces b-files, but the rules T, J, K are currently rather slow, and take time above 100 entries. The latest version of the program and its auxilliary files can be found on a Github repository.


#!perl

# Generate OEIS A030707, A055187, A217760 and related
# "cumulative counting" sequences as defined by Clark Kimberling.
# http://faculty.evansville.edu/ck6/integer/unsolved.html, Problem 4
# @(#) $Id$
# 2018-04-20, Georg Fischer (previosu version in cumulcount2.pl)
#------------------------------------------------------
# Comment from A217760:
#   Write 0 followed by segments defined inductively as follows: each segment
#   tells how many times each previously written integer occurs, in the order
#   of first occurrence.  This is Method A (adjective-before-noun pairs); for
#   Method B (noun-before-adjective), see A055168.
# Example:
#   Start with 0, followed by the adjective-noun pair 1,0; followed by
#   adjective-noun pairs 2,0 then 1,1; etc. Writing the pairs vertically,
#   the initial segments are
#   0.|.1.|.2 1.|.3 3 1.|.4 5 2 2.|.5 6 5 3 1 1.|.6 9 6 5 2 4 1.|.7 11 8 6 4 6 4 1
#   ..|.0.|.0 1.|.0 1 2.|.0 1 2 3.|.0 1 2 3 4 5.|.0 1 2 3 4 5 6.|.0 1  2 3 4 5 6 9
#
# Usage:
#   perl cumulcount.pl -m method -r row -n noeis -l len -a appear -o offset -s start -p parm -w with0 -d debug
#       All parameters are optional and have a default value:
#       method = "A" (attribute over noun; default)
#                "B" (noun over attribute)
#                "D" (new, distinct elements)
#                "I" (inverse, first occurrence of a number)
#                "J" (next term which is greater than all previous)
#                "K" (next position where term is greater than all previous)
#                "N" (number of new elements in segment)
#                "P" (positions of small numbers (parm))
#                "S" (sum of terms in segment n)
#                "T" (number of terms in segment n)
#       row    =  3 (count in both rows,    output both; default)
#                 1 (count in both rows,    output 1st)
#                 2 (count in both rows,    output 2nd)
#                 5 (count in 1st row only, output 1st)
#                 6 (count in 1st row only, output 2nd)
#       noeis  = "030707|055187|217760 ..." (OEIS number without "A", default "030707")
#       len    = length of sequence to be generated (default: 256)
#       appear = "io" (increasing order; default)
#                "do" (decreasing order)
#                "fa" (order of first appearance)
#       first  = 0, 2 (first index in @segment)
#       offset = 0, 1 (index f 1st b-file entry, default: 1)
#       start  = starting value for a(1): 0, 1 (default), 3, 4, 5
#       parm   = 2nd parameter (for rule "P"): 1, 2, 3, 4
#       with0  =  0 (0 is not counted for neither attr nor noun)
#                 1 (0 is counted for attr only)
#                 2 (0 is counted for noun only)
#                 3 (0 is counted for both attr and noun)
#       debug  = 0 (none; default)
#                1 (with segments)
#--------------------------------------------------------
use strict;

my $appear = "io";
my $debug  = 0;
my $first  = 0;
my $len    = 256;
my $method = "A";
my $noeis  = "030707";
my $offset = 1;
my $parm   = 0;
my $row    = 3; # count in both rows,    output both; default
my $start  = 1;
my $with0  = 0;

while (scalar(@ARGV) > 0) {
    my $opt = shift(@ARGV);
    if (0) {
    } elsif ($opt eq "-a") { $appear  = shift(@ARGV);
    } elsif ($opt eq "-d") { $debug   = shift(@ARGV);
    } elsif ($opt eq "-f") { $first   = shift(@ARGV);
    } elsif ($opt eq "-l") { $len     = shift(@ARGV);
    } elsif ($opt eq "-m") { $method  = shift(@ARGV);
    } elsif ($opt eq "-n") { $noeis   = shift(@ARGV);
    } elsif ($opt eq "-o") { $offset  = shift(@ARGV);
    } elsif ($opt eq "-p") { $parm    = shift(@ARGV);
    } elsif ($opt eq "-r") { $row     = shift(@ARGV);
    } elsif ($opt eq "-s") { $start   = shift(@ARGV);
    } elsif ($opt eq "-w") { $with0   = shift(@ARGV);
    } else { die "invalid option \"$opt\"\n";
    }
} # while ARGV

if ($debug == 99) {
	print " [http://oeis.org/A$noeis A$noeis] $method $start $appear $row";
	if ($offset != 1) { print " offset=$offset"; }
	if ($first  != 0) { print " first=$first"; }
	if ($parm   != 0) { print " parm=$parm"; }
	if ($with0  != 0) { print " with0=$with0"; }
	print "\n";
	exit(0);
}
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)
    = localtime (time);
my $timestamp = sprintf ("%04d-%02d-%02d %02d:%02d"
    , $year + 1900, $mon + 1, $mday, $hour, $min);
print <<"GFis";
# http://oeis.org/A$noeis/b$noeis.txt: table n,a(n) for n=1..$len
# Generated  on $timestamp by 
# perl cumulcount.pl -m $method -r $row -n $noeis -l $len -a $appear -f $first -o $offset -s $start -p $parm -w $with0 
GFis

my %inverse  = (); # inverse sequence
my $curmax = $start - 1;
my $segno = 0;
my @segment = ();
# $segment[i+0] = attribute, how often (i = 1, 3, 5 ..)
# $segment[i+1] = noun, which number is counted,
# always this order, increasing nouns, always complete with zero attributes
my @count;  # temporary copy of the attributes
my @app1st; # 1st appearance of a noun
my @seqlen = (1); # cumulative length of sequence so far, indexed with $segno
my $attr;   # attribute, count of nouns
my $noun;   # the numbers to be counted
my $iseg;   # index in @segment

# first segment
$noun = 0;
while ($noun < $start) { # fill before $start
    push(@segment, 0, $noun);
    $noun ++;
} # while filling
push(@segment, 1, $start);

# first b-file entry
my $k = $offset;
my $k2 = $k; # copy of k, running as if it were rule A
if (0) {
} elsif ($method =~ m{[ABIJKP]}i) {
    if (($row & 1) != 0) {
        &bfile($start);
    }
} elsif ($method =~ m{[D]}i) {
    print "$k $start\n"; $k ++;
} elsif ($method =~ m{[N]}i) {
    # print "$k 1\n"  ; $k ++;
    $seqlen[0] = 0;
} elsif ($method =~ m{[S]}i) {
} elsif ($method =~ m{[T]}i) {
	if ($noeis eq "240508") {
    	print "$k 1\n"; $k ++;
	}
} else {
    die "invalid method \"$method\" at bf(1)\n";
}
push(@app1st, $start);
$segno ++;

# main loop
while ($k <= $len and $segno <= $len) { # compute new segment from current
    &advance();
    $segno ++;
} # while b-file

if ($method =~ m{I}i) { # special treatment of the inverse
    $k = 1;
    foreach my $attr (sort {$a <=> $b} (keys(%inverse))) {
        last if $attr > $k; # must be monotone
        print "$k $inverse{$attr}\n"; $k ++;
    } # foreach
} # method I
#----------------
sub advance { # count between 0 and $nmax, and store in @counts
    my $amax = -1; # $nmax is the current segment length / 2
    if (1) { # compute length of current segment 
        $seqlen[$segno] = 0; # number of elements in segment
        for ($iseg = $first; $iseg < scalar(@segment); $iseg += 2) { # increment for valid entries
            $attr = $segment[$iseg + 0];
            $noun = $segment[$iseg + 1];
            if ($attr != 0 or ($with0 & 1) != 0) {
                $seqlen[$segno] ++;
            }
        } # while incrementing
    } # segment length
    
if ($debug >= 1) {
    print "seg#$segno:";
    for ($iseg = $first; $iseg < scalar(@segment); $iseg += 2) { # print the elements of this segment
        $attr = $segment[$iseg + 0];
        $noun = $segment[$iseg + 1];
        print " $attr.$noun";
    } # while copying
    print "   seqlen=$seqlen[$segno]\n";
    print "app1st: " . join(" ", @app1st) . "\n"; 
} # debug

    # now the b-file entries
    if (0) {
    } elsif ($method =~ m{[ABIJKP]}i) { # first or second row or both
        if (0) {
        } elsif ($appear eq "fa") { # order of first appearance
            for (my $iapp = 0; $iapp < scalar(@app1st)     ; $iapp ++) {
                $iseg = $app1st[$iapp] << 1;
                $attr = $segment[$iseg + 0];
                $noun = $segment[$iseg + 1];
                if ($attr != 0 or ($with0 & 1) != 0) {
                    &bfile($attr, $noun); # for method I: store %inverse only
                }
            } # for
        } elsif ($appear eq "do") { # decreasing order
            for ($iseg = scalar(@segment) - 2; $iseg >= $first; $iseg -= 2) {
                $attr = $segment[$iseg + 0];
                $noun = $segment[$iseg + 1];
                if ($attr != 0 or ($with0 & 1) != 0) {
                    &bfile($attr, $noun); # for method I: store %inverse only
                }
            } # for 
        } elsif ($appear eq "io") { # increasing order
            for ($iseg = $first; $iseg < scalar(@segment)     ; $iseg += 2) {
                $attr = $segment[$iseg + 0];
                $noun = $segment[$iseg + 1];
                if ($attr != 0 or ($with0 & 1) != 0) {
                    &bfile($attr, $noun); # for method I: store %inverse only
                }
            } # for
        } else {
            die "invalid parameter op=\"$appear\"\n";
        }

    } elsif ($method =~ m{[D]}i) { # new terms (for $appear eq "fa")
            if ($debug >= 1) {
                print "range " . ($seqlen[$segno - 1]) . ".." . ($seqlen[$segno] - 1) . "\n";
            }
            for (my $iapp = $seqlen[$segno - 1]; $iapp < $seqlen[$segno]; $iapp ++) {
                $iseg = $app1st[$iapp] << 1;
                $attr = $segment[$iseg + 0];
                $noun = $segment[$iseg + 1];
                if ($attr != 0 or ($with0 & 1) != 0) {
                    &bfile($attr, $noun); 
                }
            } # for

    } elsif ($method =~ m{[N]}i) { # no. of new terms in segment
        &bfile($seqlen[$segno] - $seqlen[$segno - 1]);

    } elsif ($method =~ m{[T]}i) { # no. of terms in segment
        &bfile($seqlen[$segno]);
    }
    #--------
    # compute following segment 
    for ($iseg = $first; $iseg < scalar(@segment) ; $iseg += 2) { # copy attr and determine maximum attr
        $attr = $segment[$iseg + 0];
        $noun = $segment[$iseg + 1];
        $count[$noun] = $attr; # copy old attr
        if ($attr > $amax) {
            $amax = $attr;
        }
    } # while copying
    my $last_noun = $noun;

    $noun = $last_noun + 1;
    while ($noun <= $amax) { # insert nouns with 0 attributes
        $count[$noun ++] = 0;
    } # while inserting
    my $ff_count = $noun;

    # now add all (or row1, row2) to @count
    if (0) {
    } elsif ($appear eq "fa") {
        for (my $iapp = 0; $iapp < $seqlen[$segno]; $iapp ++) {
            &assemble($app1st[$iapp] << 1);
        } # for $iapp
    } else { # "io", "do"
        for ($iseg = $first; $iseg < scalar(@segment); $iseg += 2) { # add
            &assemble($iseg);
        } # for $iseg
        if (0 and $noeis eq "055186") {
        } # 055186
    } # "io", "do"

    # copy it back to the segment
    $iseg = 0;
    $noun = 0;
    while ($noun < $ff_count) { # add
        $segment[$iseg + 0] = $count[$noun];
        $segment[$iseg + 1] = $noun;
        $iseg += 2;
        $noun ++;
    } # while copying back
} # sub advance
#----------------
sub assemble {
            my ($iseg) = @_;
            $attr = $segment[$iseg + 0];
            $noun = $segment[$iseg + 1];
            if (($attr != 0 or ($with0 & 1) != 0) and ($row != 6)) {
                if ($count[$attr] == 0) { # appears for the first time
                    push(@app1st, $attr);
                }
                $count[$attr] ++;
            }
            if (($attr != 0 or ($with0 & 1) != 0) and ($noun != 0 or ($with0 & 2) != 0) and ($row != 5)) {
                $count[$noun] ++;
            }
            if ($attr == 0 and $noeis eq "079668") {
            	$first = 0;
            }
} # assemble
#----------------
sub bfile {
    if ($k > $len) {
        return;
    }
    my ($attr, $noun) = @_;
    if (0) {
    } elsif ($method =~ m{P}i) {
        if ($attr == $parm) {
            print "$k $k2\n"; $k ++;
        }
        $k2 ++;
    } elsif ($method =~ m{I}i) {
        if (! defined($inverse{$attr})) {
            # assume that method "I" is called with row=1 only !
            $inverse{$attr} = $k;
            if ($debug >= 1) {
                print "# stored $k in inverse{$attr}\n";
            }
        }
        $k ++;
    } elsif ($method =~ m{J}i) {
        if ($attr > $curmax) {
            print "$k $attr\n"; $k ++;
            $curmax = $attr;
        }
        $k2 ++;
    } elsif ($method =~ m{K}i) {
        if ($attr > $curmax) {
            print "$k $k2\n"; $k ++;
            $curmax = $attr;
        }
        $k2 ++;
    } elsif (scalar(@_) == 1) {
            print "$k $attr\n"; $k ++;
    } elsif ($method =~ m{N}i) {
            print "$k $attr\n"; $k ++;
    } elsif ($method =~ m{T}i) {
            print "$k $attr\n"; $k ++;
    } elsif ($method =~ m{[AD]}i) { # attribute before noun
        if (($row & 1) != 0) { 
            print "$k $attr\n"; $k ++; 
        }
        if (($row & 2) != 0 and $k <= $len) { 
            print "$k $noun\n"; $k ++; 
        }
    } elsif ($method =~ m{[BD]}i) { # noun before attribute
        if (($row & 1) != 0) { 
            print "$k $noun\n"; $k ++; 
        }
        if (($row & 2) != 0 and $k <= $len) { 
            print "$k $attr\n"; $k ++; 
        }
    } else {
        die "invalid method \"$method\" in sub bfile\n";
    }
} # bfile
__DATA__
Rule A, A055187:
1 | 1 | 3 | 4  1 |  6  2  1 |  8  1  3  2  1 |
  | 1 | 1 | 1  3 |  1  3  4 |  1  2  3  4  6 |

  | 11  3  5  3  2  1  | 13  5  8  4  1  3  2  1 |
  |  1  2  3  4  6  8  |  1  2  3  4  5  6  8 11 |

  | 16  7 10  6  3  4  4  2  1 |
  |  1  2  3  4  5  6  8 11 13 |

  | 18  9 12  9  4  6  1  5  1  3  2  1 |
  |  1  2  3  4  5  6  7  8 10 11 13 16 |

  | 22 11 14 11  6  8  2  6  2  2  4  1  3  2  1 |
  |  1  2  3  4  5  6  7  8  9 10 11 12 13 16 18 |

  | 25 16 16 14 ...
  |  1  2  3  4 ...

--------------------
A030717 (row 1), A030718 (row2) - zeroes are inconsistent
1 | 1 | 2 | 2, 1 | 3, 2 | 3, 3, 1 | 4, 3, 3 | 4, 3, 5, 1 | 5, 3, 6, 2, 1
  | 1 | 1 | 1, 2 | 1, 2 | 1, 2, 3 | 1, 2, 3 | 1, 2, 3, 4 | 1, 2, 3, 4, 5

  | 6, 4, 7, 2, 2, 1 | 7, 6, 7, 3, 2, 2, 1| 8, 8, 8, 3, 2, 3, 3
  | 1, 2, 3, 4, 5, 6 | 1, 2, 3, 4, 5, 6, 7| 1, 2, 3, 4, 5, 6, 7

  | 8, 9, 11, 3, 2, 3, 3, 3 | 8, 10, 15, 3, 2, 3, 3, 4, 1,  0,  1
  | 1, 2,  3, 4, 5, 6, 7, 8 | 1,  2,  3, 4, 5, 6, 7, 8, 9,     11

  | 10, 11, 18, 4, 2, 3, 3, 5, 1,  1,  1, 0, 0, 0,  1
  |  1,  2,  3, 4, 5, 6, 7, 8, 9, 10, 11,          15

  | 14, 12, 20, 5, 3, 3, 3, 5, 1,  2,  2, 0, 0, 0,  1, 0, 0,  1
  |  1,  2,  3, 4, 5, 6, 7, 8, 9, 10, 11,          15,       18

  | 17, 14, 23, 5, 5
  |  1,  2,  3  ...
#----------------------------------------------
A051120 ,1|1,1|3,1|1,3,4,1|1,4,2,3,6,1|1,6,2,4,3,3,1,2,8,1|1,8,2,6,3,4,5,3,3,2,11,1|1,11,2,8,3,6,1,5,4,4,8,3,5,2,13,1|1,13,2,11,4,8,4,6,3,5,6,4,10,3,7,2,16,1,1,16,2,13,3,11,1,10,5,8,1,7,6,6,4,5,9,4,12,3,9,2,18,1,
A055187 ,1|1,1|3,1|4,1,1,3|6,1,2,3,1,4|8,1,1,2,3,3,2,4,1,6|11,1,3,2,5,3,3,4,2,6,1,8|13,1,5,2,8,3,4,4,1,5,3,6,2,8,1,11|16,1,7,2,10,3,6,4,3,5,4,6,4,8,2,11,1,13,18,1,9,2,12,3,9,4,4,5,6,6,1,7,5,8,1,10,3,11,2,13,1,16,22,1,


makefile

A Unix makefile was used

  • to produce the list of sequences,
  • to download (once) the corresponding b-files,
  • to regenerate the particular sequences and
  • to compare them against the stored b-files.

#!make

# Generate OEIS A030707, A055187, A217760 and related 
# "cumulative counting" sequences as defined by Clark Kimberling.
# http://faculty.evansville.edu/ck6/integer/unsolved.html, Problem 4
# @(#) $Id$
# 2018-04-27, Georg Fischer (previosu version in makefile2)
#
# C.f. listing.tmp (produced by target "listing", below)
# Needs cumulcount.pl in current directory, and
# Unix tools diff, echo, grep, head, make, perl, sed, tee, test, wget
#---------------------------------
TARGET=cumulcount
SIL=
LIMIT=100
APPEAR=io
DEBUG=0
FIRST=0
LEN=$(LIMIT)
OFFSET=1
PARM=0
ROW=3
START=1
WITH0=0

all:    0307nn 0551nn misc
quick:  030707 030708 030717 030718 055168 055186 055187 misc
0307nn: 0307io 0307do 
0551nn: 05516n 05518n 
#----------
misc:   051120 \
		079668 079686 \
		126027 253170 \
		174382 240508\
		2177nn 
051120: # A055187, but decreasing
	make $(SIL) $(TARGET) METHOD=A  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=1 OFFSET=0 FIRST=2

079668:
	make $(SIL) $(TARGET) METHOD=A  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1 WITH0=3 FIRST=2
079686:
	make $(SIL) $(TARGET) METHOD=A  ROW=3 NOEIS=$@ LEN=1000     APPEAR=do START=0 WITH0=3 OFFSET=0

126027: # row lengths of A030717; trick with OFFSET 2: 1st entry is missing
	make $(SIL) $(TARGET) METHOD=T  ROW=5 NOEIS=$@ LEN=24       APPEAR=io START=1 WITH0=3
253170: # row sums     of A030717
	# nyi
	
174382: # like 030717
	make $(SIL) $(TARGET) METHOD=A  ROW=5 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=0 WITH0=3
240508: # row lengths in A174382; 1st two lines wrong
	make $(SIL) $(TARGET) METHOD=T  ROW=5 NOEIS=$@ LEN=24       APPEAR=io START=0 WITH0=3

2177_list:
	grep -aE "^A2177" ../names
2177nn: 217760 217780 #	ok
217760: # c.f. 055186
	make $(SIL) $(TARGET) METHOD=A  ROW=3 NOEIS=$@ LEN=10000    APPEAR=fa START=0 WITH0=2
217780: # c.f. 055187
	make $(SIL) $(TARGET) METHOD=A  ROW=3 NOEIS=$@ LEN=10000    APPEAR=fa START=1
#----------
0307_list:
	grep -aE "^A0307" ../names
0307_compare:
	diff -w -y --width=32 --suppress-common-lines b030709.txt b030759.txt || :  
	diff -w -y --width=32 --suppress-common-lines b030729.txt b030779.txt || :  
	diff -w -y --width=32 --suppress-common-lines b030739.txt b030769.txt || :  
	diff -w -y --width=32 --suppress-common-lines b030749.txt b030799.txt || :  
	diff -w -y --width=32 --suppress-common-lines b030711.txt b030761.txt || :  
	
0307io: 03070n 03071n 03072n 03073n 03074n
03070n: 030707 030708 030709 030710 030711 030712 030713 030714 030715 030716
03071n: 030717 030718 030719 030720 030721 030722 030723 030724 030725 030726
03072n: 030727 030728 030729 030730 030731 030732 030733 030734 030735 030736
03073n:	030737 030738 030739 030740 030741 030742 030743 030744 030745 030746
03074n:	030747 030748 030749 030750 030751 030752 030753 030754 030755 030756

0307do:                                    03075n 03076n 03077n 03078n
03075n:	030757 030758 030759 030760 030761 030762 030763 030764 030765 030766
03076n:	030767 030768 030769 030770 030771 030772 030773 030774 030775 030776
03077n:	030777 030778 030779 030780 030781 030782 030783 030784 030785 030786
03078n:	030787 030788 030789 030790 030791 030792 030793 030794 030795 030796

030707:
	make $(SIL) $(TARGET) METHOD=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1
030708:
	make $(SIL) $(TARGET) METHOD=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1
030709:
	make $(SIL) $(TARGET) METHOD=T  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1
030710:
	make $(SIL) $(TARGET) METHOD=I  ROW=1 NOEIS=$@ LEN=2000     APPEAR=io START=1
030711:
	make $(SIL) $(TARGET) METHOD=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1
030712:
	make $(SIL) $(TARGET) METHOD=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1
030713:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1 PARM=1
030714:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1 PARM=2
030715:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1 PARM=3
030716:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1 PARM=4

030717:
	make $(SIL) $(TARGET) METHOD=A  ROW=5 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1 WITH0=3
030718:
	make $(SIL) $(TARGET) METHOD=A  ROW=6 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1
030719:
	make $(SIL) $(TARGET) METHOD=T  ROW=5 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1
030720:
	make $(SIL) $(TARGET) METHOD=I  ROW=5 NOEIS=$@ LEN=2000     APPEAR=io START=1
030721:
	make $(SIL) $(TARGET) METHOD=J  ROW=5 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1
030722:
	make $(SIL) $(TARGET) METHOD=K  ROW=5 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1
030723:
	make $(SIL) $(TARGET) METHOD=P  ROW=5 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1 PARM=1
030724:
	make $(SIL) $(TARGET) METHOD=P  ROW=5 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1 PARM=2
030725:
	make $(SIL) $(TARGET) METHOD=P  ROW=5 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1 PARM=3
030726:
	make $(SIL) $(TARGET) METHOD=P  ROW=5 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1 PARM=4

030727:
	make $(SIL) $(TARGET) METHOD=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=3
030728:
	make $(SIL) $(TARGET) METHOD=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=3
030729:
	make $(SIL) $(TARGET) METHOD=T  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=3
030730:
	make $(SIL) $(TARGET) METHOD=I  ROW=1 NOEIS=$@ LEN=2000     APPEAR=io START=3
030731:
	make $(SIL) $(TARGET) METHOD=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=3
030732:
	make $(SIL) $(TARGET) METHOD=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=3
030733:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=3 PARM=1
030734:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=3 PARM=2
030735:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=3 PARM=3
030736:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=3 PARM=4

030737:
	make $(SIL) $(TARGET) METHOD=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=2
030738:
	make $(SIL) $(TARGET) METHOD=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=2
030739:
	make $(SIL) $(TARGET) METHOD=T  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=2
030740:
	make $(SIL) $(TARGET) METHOD=I  ROW=1 NOEIS=$@ LEN=2000     APPEAR=io START=2
030741:
	make $(SIL) $(TARGET) METHOD=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=2
030742:
	make $(SIL) $(TARGET) METHOD=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=2
030743:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=2 PARM=1
030744:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=2 PARM=2
030745:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=2 PARM=3
030746:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=2 PARM=4

030747:
	make $(SIL) $(TARGET) METHOD=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=4
030748:
	make $(SIL) $(TARGET) METHOD=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=4
030749:
	make $(SIL) $(TARGET) METHOD=T  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=4
030750:
	make $(SIL) $(TARGET) METHOD=I  ROW=1 NOEIS=$@ LEN=2000     APPEAR=io START=4
030751:
	make $(SIL) $(TARGET) METHOD=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=4
030752:
	make $(SIL) $(TARGET) METHOD=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=4
030753:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=4 PARM=1
030754:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=4 PARM=2
030755:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=4 PARM=3
030756:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=4 PARM=4

030757:
	make $(SIL) $(TARGET) METHOD=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=1
030758:
	make $(SIL) $(TARGET) METHOD=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=1
030759:
	make $(SIL) $(TARGET) METHOD=T  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=1
030760:
	make $(SIL) $(TARGET) METHOD=I  ROW=1 NOEIS=$@ LEN=2000     APPEAR=do START=1
030761:
	make $(SIL) $(TARGET) METHOD=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=1
030762:
	make $(SIL) $(TARGET) METHOD=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=1
030763:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=1 PARM=1
030764:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=1 PARM=2
030765:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=1 PARM=3
030766:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=1 PARM=4

030767:
	make $(SIL) $(TARGET) METHOD=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=2
030768:
	make $(SIL) $(TARGET) METHOD=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=2
030769:
	make $(SIL) $(TARGET) METHOD=T  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=2
030770:
	make $(SIL) $(TARGET) METHOD=I  ROW=1 NOEIS=$@ LEN=2000     APPEAR=do START=2
030771:
	make $(SIL) $(TARGET) METHOD=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=2
030772:
	make $(SIL) $(TARGET) METHOD=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=2
030773:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=2 PARM=1
030774:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=2 PARM=2
030775:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=2 PARM=3
030776:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=2 PARM=4

030777:
	make $(SIL) $(TARGET) METHOD=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=3
030778:
	make $(SIL) $(TARGET) METHOD=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=3
030779:
	make $(SIL) $(TARGET) METHOD=T  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=3
030780:
	make $(SIL) $(TARGET) METHOD=I  ROW=1 NOEIS=$@ LEN=2000     APPEAR=do START=3
030781:
	make $(SIL) $(TARGET) METHOD=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=3
030782:
	make $(SIL) $(TARGET) METHOD=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=3
030783:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=3 PARM=1
030784:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=3 PARM=2
030785:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=3 PARM=3
030786:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=3 PARM=4

030787:
	make $(SIL) $(TARGET) METHOD=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=4
030788:
	make $(SIL) $(TARGET) METHOD=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=4
030789:
	make $(SIL) $(TARGET) METHOD=T  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=4
030790:
	make $(SIL) $(TARGET) METHOD=I  ROW=1 NOEIS=$@ LEN=2000     APPEAR=do START=4
030791:
	make $(SIL) $(TARGET) METHOD=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=4
030792:
	make $(SIL) $(TARGET) METHOD=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=4
030793:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=4 PARM=1
030794:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=4 PARM=2
030795:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=4 PARM=3
030796:
	make $(SIL) $(TARGET) METHOD=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) APPEAR=do START=4 PARM=4
#----------
0551_list:
	grep -aE "^A0551" ../names
05516n: 055168 055169 055170\
		055171 055172 055173\
		055174 055175 055176\
		055177 055178 055179\
		055180 055181 055182\
		055183 055184 055185
055168:
	make $(SIL) $(TARGET) METHOD=B  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=0 WITH0=2
055169:
	make $(SIL) $(TARGET) METHOD=N  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=0 WITH0=2
055170:
	make $(SIL) $(TARGET) METHOD=D  ROW=2 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=0 WITH0=2
055171:
	make $(SIL) $(TARGET) METHOD=B  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=1
055172:
	make $(SIL) $(TARGET) METHOD=N  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=1
055173:
	make $(SIL) $(TARGET) METHOD=D  ROW=2 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=1
055174:
	make $(SIL) $(TARGET) METHOD=B  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=2
055175:
	make $(SIL) $(TARGET) METHOD=N  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=2
055176:
	make $(SIL) $(TARGET) METHOD=D  ROW=2 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=2
055177:
	make $(SIL) $(TARGET) METHOD=B  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=3
055178:
	make $(SIL) $(TARGET) METHOD=N  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=3
055179:
	make $(SIL) $(TARGET) METHOD=D  ROW=2 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=3
055180:
	make $(SIL) $(TARGET) METHOD=B  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=4
055181:
	make $(SIL) $(TARGET) METHOD=N  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=4
055182:
	make $(SIL) $(TARGET) METHOD=D  ROW=2 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=4
055183:
	make $(SIL) $(TARGET) METHOD=B  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=5
055184:
	make $(SIL) $(TARGET) METHOD=N  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=5
055185:
	make $(SIL) $(TARGET) METHOD=D  ROW=2 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=5
#-----
05518n: 055186 055187 \
		055188 055189 055190 055191
055186:
	make $(SIL) $(TARGET) METHOD=A  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=0 WITH0=3
055187:
	make $(SIL) $(TARGET) METHOD=A  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=io START=1 WITH0=2
055188:
	make $(SIL) $(TARGET) METHOD=A  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=2
055189:
	make $(SIL) $(TARGET) METHOD=A  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=3
055190:
	make $(SIL) $(TARGET) METHOD=A  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=4
055191:
	make $(SIL) $(TARGET) METHOD=A  ROW=3 NOEIS=$@ LEN=$(LIMIT) APPEAR=fa START=5
#---------------------------------------------------------------
cumulcount:
	# -------------------------------------------------------
	test -s b$(NOEIS).txt || wget http://oeis.org/A$(NOEIS)/b$(NOEIS).txt
	grep -E "^[0-9]" b$(NOEIS).txt    | head -n $(LEN)                           > bf.tmp
#	wc -l bf.tmp
	perl cumulcount.pl -m $(METHOD) -r $(ROW) -n $(NOEIS) -l $(LEN) -a $(APPEAR) -f $(FIRST) -o $(OFFSET) -s $(START) -p $(PARM) -w $(WITH0) -d $(DEBUG) > A$(NOEIS).pn.tmp
	grep -E "^[0-9]" A$(NOEIS).pn.tmp | head -n `wc -l bf.tmp | cut -d " " -f 1` > pn.tmp
#	diff -w -y                         --width=32  bf.tmp pn.tmp || :
	diff -w -y --suppress-common-lines --width=32  bf.tmp pn.tmp | head -n 8
#
debug:
	# -------------------------------------------------------
	perl cumulcount.pl -m $(METHOD) -r $(ROW) -n $(NOEIS) -l $(LEN) -a $(APPEAR) -f $(FIRST) -o $(OFFSET) -s $(START) -p $(PARM) -w $(WITH0) -d 1 | less
#--------
list1:
	perl cumulcount.pl -m $(METHOD) -r $(ROW) -n $(NOEIS) -l $(LEN) -a $(APPEAR) -f $(FIRST) -o $(OFFSET) -s $(START) -p $(PARM) -w $(WITH0) -d 99 
#	echo " " [https://oeis.org/A$(NOEIS) A$(NOEIS)] Rule $(RULE).$(ROW) $(ORD) $(P1) $(P2) " "\
#	`wc -l b$(NOEIS).txt | cut -d " " -f 1`
listing:
	make -s all TARGET=list1 | sort \
	| tee listing.tmp
	wc -l listing.tmp
#--------
# e.g. https://oeis.org/search?q=id:A257908&fmt=text
intern1:
	test -s A$(NOEIS).int || wget -O A$(NOEIS).int "http://oeis.org/search?q=id:A$(NOEIS)\&fmt=text" 
internal: 
	make $(SIL) all TARGET=intern1