OEIS/Cumulative counting

From tehowiki
Revision as of 08:47, 25 April 2018 by imported>Gfis (1st)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Clark Kimberling defined - for example - A131388 with the following rule:

Rule 1 follows.  For k >= 1, let  A(k) = {a(1), …, a(k)} and D(k) = {d(1), …, d(k)}.  Begin with k = 1 and nonnegative integers a(1) and d(1).
Step 1:   If there is an integer h such that 1 - a(k) < h < 0 and h is not in D(k) and a(k) + h is not in A(k), let d(k+1) be the greatest such h, let a(k+1) = a(k) + h, replace k by k + 1, and repeat Step 1; otherwise do Step 2.
Step 2:  Let h be the least positive integer not in D(k) such that a(k) + h is not in A(k).  Let a(k+1) = a(k) + h and d(k+1) = h.  Replace k by k+1 and do Step 1.
Conjecture:  if a(1) is an nonnegative integer and d(1) is an integer, then (a(n)) is a permutation of the nonnegative integers (if a(1) = 0) or a permutation of the positive integers (if a(1) > 0).  Moreover, (d(n)) is a permutation of the integers if d(1) = 0, or of the nonzero integers if d(1) > 0.

Depending on the starting values a(1) and d(1), and with variations of the rules, there are several dozens of related sequences in the OEIS. There are lists of related sequences in A257705, A257883 and A257905.

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 OEIS A-number,
  • a major rule name (A, B were defined by C. Kimberling)
  • a minor rule number, the row number (1, 2, ...)
  • a code for the ordering in the segements
  • the starting value s(1)
  • an optional small integer parameter
  • the number of lines in the b-file
A030707 Rule A.1 io 1    84
A030708 Rule A.2 io 1    82
A030709 Rule T   io 1    30
A030710 Rule I.1 io 1    54
A030711 Rule J.1 io 1    32
A030712 Rule K.1 io 1    32
A030713 Rule P.1 io 1 1  52
A030714 Rule P.1 io 1 2  50
A030715 Rule P.1 io 1 3  50
A030716 Rule P.1 io 1 4  49
A030717 Rule A.3 io 1    1732
A030718 Rule A.4 io 1
A030719 Rule T   io 1
A030720 Rule I.3 io 1
A030721 Rule J.3 io 1
A030722 Rule K.3 io 1
A030723 Rule P.3 io 1 1
A030724 Rule P.3 io 1 2
A030725 Rule P.3 io 1 3
A030726 Rule P.3 io 1 4
A030727 Rule A.1 io 3    83
A030728 Rule A.2 io 3    83
A030729 Rule T   io 3    29
A030730 Rule I.1 io 3    53
A030731 Rule J.1 io 3    29
A030732 Rule K.1 io 3    29
A030733 Rule P.1 io 3 1  51
A030734 Rule P.1 io 3 2  50
A030735 Rule P.1 io 3 3  46
A030736 Rule P.1 io 3 4  49
A030737 Rule A.1 io 2    83
A030738 Rule A.2 io 2    83
A030739 Rule T   io 2    29
A030740 Rule I.1 io 2    53
A030741 Rule J.1 io 2    30
A030742 Rule K.1 io 2    30
A030743 Rule P.1 io 2 1  52
A030744 Rule P.1 io 2 2  50
A030745 Rule P.1 io 2 3  49
A030746 Rule P.1 io 2 4  49
A030747 Rule A.1 io 4    82
A030748 Rule A.2 io 4    86
A030749 Rule T   io 4    30
A030750 Rule I.1 io 4    53
A030751 Rule J.1 io 4    29
A030752 Rule K.1 io 4    29
A030753 Rule P.1 io 4 1  51
A030754 Rule P.1 io 4 2  49
A030755 Rule P.1 io 4 3  46
A030756 Rule P.1 io 4 4  33
A030757 Rule A.1 do 1    84
A030758 Rule A.2 do 1    81
A030759 Rule T   do 1    29
A030760 Rule I.1 do 1    53
A030761 Rule J.1 do 1    29
A030762 Rule K.1 do 1    29
A030763 Rule P.1 do 1 1  52
A030764 Rule P.1 do 1 2  50
A030765 Rule P.1 do 1 3  50
A030766 Rule P.1 do 1 4  49
A030767 Rule A.1 do 2    86
A030768 Rule A.2 do 2    81
A030769 Rule T   do 2    29
A030770 Rule I.1 do 2    53
A030771 Rule J.1 do 2    36
A030772 Rule K.1 do 2    36
A030773 Rule P.1 do 2 1  52
A030774 Rule P.1 do 2 2  51
A030775 Rule P.1 do 2 3  49
A030776 Rule P.1 do 2 4  49
A030777 Rule A.1 do 3    85
A030778 Rule A.2 do 3    81
A030779 Rule T   do 3    29
A030780 Rule I.1 do 3    53
A030781 Rule J.1 do 3    29
A030782 Rule K.1 do 3    29
A030783 Rule P.1 do 3 1  52
A030784 Rule P.1 do 3 2  50
A030785 Rule P.1 do 3 3  49
A030786 Rule P.1 do 3 4  49
A030787 Rule A.1 do 4    83
A030788 Rule A.2 do 4    83
A030789 Rule T   do 4    30
A030790 Rule I.1 do 4    53
A030791 Rule J.1 do 4    30
A030792 Rule K.1 do 4    30
A030793 Rule P.1 do 4 1  51
A030794 Rule P.1 do 4 2  49
A030795 Rule P.1 do 4 3  46
A030796 Rule P.1 do 4 4  33
A055168 Rule B   fa 0    90
A055169 Rule N   fa 0    10000
A055170 Rule D   fa 0    6000
A055171 Rule B   fa 1    87
A055172 Rule N   fa 1    39
A055173 Rule D   fa 1    64
A055174 Rule B   fa 2    88
A055175 Rule N   fa 2    39
A055176 Rule D   fa 2    64
A055177 Rule B   fa 3    87
A055178 Rule N   fa 3    39
A055179 Rule D   fa 3    64
A055180 Rule B   fa 4    88
A055181 Rule N   fa 4    39
A055182 Rule D   fa 4    64
A055183 Rule B   fa 5    87
A055184 Rule N   fa 5    39
A055185 Rule D   fa 5    64
A055186 Rule A   iz 0    1022
A055187 Rule A   io 1    98
A055188 Rule A   fa 2    87
A055189 Rule A   fa 3    87
A055190 Rule A   fa 4    89
A055191 Rule A   fa 5    87
A217760 Rule A   fa 0    9666
A217780 Rule A   fa 1    71

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
#------------------------------------------------------
# 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 rule row noeis len order p1 [p2 [debug]]
#       rule  = "A" (attribute before noun)
#               "B" (noun before 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 (p2))
#               "T" (number of terms in segment n)
#       row   = 0 (both)  
#               1 (first)  
#               2 (second)
#               3 (first,  count in first only)
#               4 (second, count in first only)
#       noeis = "030707|055187|217760 ..." (OEIS number without "A")
#       len   = length of sequence to be generated
#       order = "io" (increasing order) 
#               "do" (decreasing order) 
#               "iz" (increasing order, complete with zero counts)
#               "dz" (decreasing order, complete with zero counts)
#               "fa" (order of first appearance)
#       p1    = starting value for a(1): 0, 1, 3, 4, 5
#       p2    = 2nd parameter (for rule "P"): 1, 2, 3, 4 
#       debug = 0 (none)
#               1 (with segments)
#--------------------------------------------------------
use strict;

my $rule   = "A"; if (scalar(@ARGV) > 0) { $rule  = shift(@ARGV); }
my $row   = 0;    if (scalar(@ARGV) > 0) { $row   = shift(@ARGV); }
my $noeis = "";   if (scalar(@ARGV) > 0) { $noeis = shift(@ARGV); }
my $len   = 256;  if (scalar(@ARGV) > 0) { $len   = shift(@ARGV); }
my $order = "io"; if (scalar(@ARGV) > 0) { $order = shift(@ARGV); }
my $p1    = 1;    if (scalar(@ARGV) > 0) { $p1    = shift(@ARGV); }
my $p2    = 0;    if (scalar(@ARGV) > 0) { $p2    = shift(@ARGV); }
my $debug = 0;    if (scalar(@ARGV) > 0) { $debug = shift(@ARGV); }

# segments have 2 rows:
# row 1 = attrs
# row 2 = nouns
my $attr;
my $noun;
my %nouns;
my %occrs = (); # first occurrences of attributes
my @seql  = (); # sequence list
push(@seql, $p1, 1, $p1);
#            0   1   2  3
my $segno = 1;
my $sseg  = 1;             # index of 1st element in segment
my $eseg  = scalar(@seql); # index of 1st element behind segment
my $inoun;
my $sum;
my $search = $p2; # for $rule =~ m{P}
my $curmax = 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)
# Generated by cumulcount.pl on $timestamp 
GFis
my $k = 1;
my $k2 = $k; # copy of k, running as if it were rule A    
    if (0) {
    } elsif ($rule =~ m{[ABIJKP]}i) {
        if ($row <= 1) {
            &bfile($p1);
        }
        &bfile(1, $p1);
    } elsif ($rule =~ m{D}i) {
        print "$k $p1\n"; $k ++;
    } elsif ($rule =~ m{N}i) {
        print "$k 1\n"  ; $k ++;
    } elsif ($rule =~ m{T}i) {
        print "$k $p1\n"; $k ++;
    } else {
        die "invalid rule \"$rule\"\n";
    }
$segno ++;
while ($k <= $len) { # fill b-file
    my %nouns = ();
    $inoun = $sseg;
    while ($inoun < $eseg) { # count the present nouns (row 2)
        my $attr = $seql[$inoun + 0];
        my $noun = $seql[$inoun + 1];
        if (1) {
            $sum = $attr + &count(2, $noun, $sseg, $eseg);
            $nouns{$noun} = $sum;
            push(@seql, $sum, $noun);
        }
        $inoun += 2;
    } # while $inoun
    $inoun = $sseg;
    my $start_new = scalar(@seql);
    while ($inoun < $eseg) { # count the new attributes (row 1)
        my $attr = $seql[$inoun + 0];
        if (! defined($nouns{$attr})) {
            $sum =         &count(1, $attr, $sseg, $eseg);
            $nouns{$attr} = $sum;
            push(@seql, $sum, $attr);
        }
        $inoun += 2;
    } # while $inoun

    if (0) {
    } elsif ($order eq "fa") { # order of first appearance
        # already stored in @seql
    } elsif ($order eq "do") { # decreasing order
        $inoun = $eseg;
        foreach $noun (sort {$b <=> $a} (keys(%nouns))) { # reverse sort
            $seql[$inoun + 0] = $nouns{$noun};
            $seql[$inoun + 1] = $noun;
            $inoun += 2;
        } # foreach
    } elsif ($order eq "io") { # increasing order
        $inoun = $eseg;
        foreach $noun (sort {$a <=> $b} (keys(%nouns))) {
            $seql[$inoun + 0] = $nouns{$noun};
            $seql[$inoun + 1] = $noun;
            $inoun += 2;
        } # foreach
    } elsif ($order eq "dz") { # decreasing order (complete) - insert 0 counts
        my $cnoun = 0; # avoids "while" in first "foreach"
        $inoun = $eseg;
        foreach $noun (sort {$b <=> $a} (keys(%nouns))) { # reverse sort
            while ($cnoun > $noun) {
                $seql[$inoun + 0] = 0;
                $seql[$inoun + 1] = $cnoun;
                $cnoun --;
                $inoun += 2;
            } # while $cnoun
            $seql[$inoun + 0] = $nouns{$noun};
            $seql[$inoun + 1] = $noun;
            $inoun += 2;
            $cnoun = $noun - 1;
        } # foreach
    } elsif ($order eq "iz") { # increasing order (complete) - insert 0 counts
        my $cnoun = $seql[$sseg + 1];
        $inoun = $eseg;
        foreach $noun (sort {$a <=> $b} (keys(%nouns))) {
            while ($cnoun < $noun) {
                $seql[$inoun + 0] = 0;
                $seql[$inoun + 1] = $cnoun;
                $cnoun ++;
                $inoun += 2;
            } # while $cnoun
            $seql[$inoun + 0] = $nouns{$noun};
            $seql[$inoun + 1] = $noun;
            $inoun += 2;
            $cnoun = $noun + 1;
        } # foreach
    } else {
        die "invalid paramter op=\"$order\"\n";
    }

    if ($debug >= 1) {
        print "# segment $segno:";
        $inoun = $eseg;
        while ($inoun < scalar(@seql)) { #
            my $attr = $seql[$inoun + 0];
            my $noun = $seql[$inoun + 1];
            print " $attr.$noun";
            $inoun += 2;
        } # while $inoun
        print "\n";
    } # debug

    if (0) {
    } elsif ($rule =~ m{[ABIJKP]}i) { # first or second row or both
        $inoun = $eseg;
        while ($inoun < scalar(@seql)) {
            my $attr = $seql[$inoun + 0];
            my $noun = $seql[$inoun + 1];
            &bfile($attr, $noun);
            $inoun += 2;
        } # while $inoun
    } elsif ($rule =~ m{D}i) { # new terms
        $inoun = $start_new;
        while ($inoun < scalar(@seql)) {
            my $attr = $seql[$inoun + 0];
            my $noun = $seql[$inoun + 1];
            &bfile($noun);
            $inoun += 2;
        } # while $inoun
    } elsif ($rule =~ m{N}i) { # no. of new terms in segment
        my $no_new = (scalar(@seql) - $start_new) >> 1;
        &bfile($no_new);
    } elsif ($rule =~ m{T}i) { # no. of terms in segemnt
        my $no_new = (scalar(@seql) - $eseg) >> 1;
        &bfile($no_new);
    }
    $sseg = $eseg;
    $eseg = scalar(@seql);
    $segno ++;
} # while b-file

if ($rule =~ m{I}i) { # special treatment of the inverse
    $k = 1;
    foreach $attr (sort {$a <=> $b} (keys(%occrs))) {
        # last if $attr > $k; # must be monotone
        print "$k $occrs{$attr}\n"; $k ++;
    } # foreach
} # rule I
#----------------
sub bfile {
    my ($attr, $noun) = @_;
    if (0) {
    } elsif ($rule =~ m{P}i) {
        if ($attr == $search) {
            print "$k $k2\n"; $k ++;
        }
        $k2 ++;
    } elsif ($rule =~ m{I}i) {
        if (! defined($occrs{$attr})) {
            # assume that rule "I" is called with row=1 only !
            $occrs{$attr} = $k;
            if ($debug >= 1) {
                print "# stored $k in occrs{$attr}\n";
            }
        }
        $k ++;
    } elsif ($rule =~ m{J}i) {
        if ($attr > $curmax) {
            print "$k $attr\n"; $k ++;
            $curmax = $attr;
        }
        $k2 ++;
    } elsif ($rule =~ m{k}i) {
        if ($attr > $curmax) {
            print "$k $k2\n"; $k ++;
            $curmax = $attr;
        }
        $k2 ++;
    } elsif (scalar(@_) == 1) {
        print "$k $attr\n"; $k ++;
    } elsif ($rule =~ m{[DNT]}i) {
        # c.f. above
    } elsif ($rule =~ m{[A]}i) { # attribute before noun
        if (0) {
        } elsif ($row == 0) { 
            print "$k $attr\n"; $k ++;
            print "$k $noun\n"; $k ++;
        } elsif ($row == 1) {
            print "$k $attr\n"; $k ++;
        } elsif ($row == 2) {
            print "$k $noun\n"; $k ++;
        }
    } elsif ($rule =~ m{B}i) { # noun before attribute
        if (0) {
        } elsif ($row == 0) {
        	print "$k $noun\n"; $k ++;
        	print "$k $attr\n"; $k ++;
        } elsif ($row == 1) {
        	print "$k $noun\n"; $k ++;
        } elsif ($row == 2) {
        	print "$k $attr\n"; $k ++;
        }
    } else {
        die "invalid rule \"$rule\"\n";
    }
} # bfile
#----------------
sub count {
    my ($row, $value, $sseg, $eseg) = @_;
    my $sum = 0;
    if (($rule !~ m{C}i) or ($row == 1)) { #
        my $iseg = $sseg;
        while ($iseg < $eseg) {
            if ($seql[$iseg] == $value) { # attr or noun
                $sum ++;
            }
            $iseg ++;
            if ($rule eq "C") {
                $iseg ++;
            }
        } # while $iseg
    } # if cond
    return $sum;
} # sub count
__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 ...

--------------------
Rule C; 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  ...
# https://oeis.org/wiki/User:Georg_Fischer Feb. 24, 2018

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-20, Georg Fischer
#
# 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
LIMIT=100
P2=0

all: 0307io 0307do 05516n 05518n 2177nn
#----------
0307_list:
	grep -aE "^A0307" ../names

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 $(TARGET) RULE=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1
030708:
	make $(TARGET) RULE=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1
030709:
	make $(TARGET) RULE=T  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1
030710:
	make $(TARGET) RULE=I  ROW=1 NOEIS=$@ LEN=2000     ORD=io P1=1
030711:
	make $(TARGET) RULE=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1
030712:
	make $(TARGET) RULE=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1
030713:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1 P2=1
030714:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1 P2=2
030715:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1 P2=3
030716:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1 P2=4

030717:
	make $(TARGET) RULE=A  ROW=3 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1
030718:
	make $(TARGET) RULE=A  ROW=4 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1
030719:
	make $(TARGET) RULE=T  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1
030720:
	make $(TARGET) RULE=I  ROW=3 NOEIS=$@ LEN=2000     ORD=io P1=1
030721:
	make $(TARGET) RULE=J  ROW=3 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1
030722:
	make $(TARGET) RULE=K  ROW=3 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1
030723:
	make $(TARGET) RULE=P  ROW=3 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1 P2=1
030724:
	make $(TARGET) RULE=P  ROW=3 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1 P2=2
030725:
	make $(TARGET) RULE=P  ROW=3 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1 P2=3
030726:
	make $(TARGET) RULE=P  ROW=3 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1 P2=4

030727:
	make $(TARGET) RULE=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=3
030728:
	make $(TARGET) RULE=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=3
030729:
	make $(TARGET) RULE=T  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=3
030730:
	make $(TARGET) RULE=I  ROW=1 NOEIS=$@ LEN=2000     ORD=io P1=3
030731:
	make $(TARGET) RULE=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=3
030732:
	make $(TARGET) RULE=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=3
030733:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=3 P2=1
030734:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=3 P2=2
030735:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=3 P2=3
030736:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=3 P2=4

030737:
	make $(TARGET) RULE=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=2
030738:
	make $(TARGET) RULE=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=2
030739:
	make $(TARGET) RULE=T  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=2
030740:
	make $(TARGET) RULE=I  ROW=1 NOEIS=$@ LEN=2000     ORD=io P1=2
030741:
	make $(TARGET) RULE=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=2
030742:
	make $(TARGET) RULE=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=2
030743:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=2 P2=1
030744:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=2 P2=2
030745:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=2 P2=3
030746:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=2 P2=4

030747:
	make $(TARGET) RULE=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=4
030748:
	make $(TARGET) RULE=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=4
030749:
	make $(TARGET) RULE=T  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=4
030750:
	make $(TARGET) RULE=I  ROW=1 NOEIS=$@ LEN=2000     ORD=io P1=4
030751:
	make $(TARGET) RULE=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=4
030752:
	make $(TARGET) RULE=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=4
030753:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=4 P2=1
030754:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=4 P2=2
030755:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=4 P2=3
030756:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=4 P2=4

030757:
	make $(TARGET) RULE=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=1
030758:
	make $(TARGET) RULE=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=1
030759:
	make $(TARGET) RULE=T  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=1
030760:
	make $(TARGET) RULE=I  ROW=1 NOEIS=$@ LEN=2000     ORD=do P1=1
030761:
	make $(TARGET) RULE=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=1
030762:
	make $(TARGET) RULE=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=1
030763:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=1 P2=1
030764:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=1 P2=2
030765:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=1 P2=3
030766:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=1 P2=4

030767:
	make $(TARGET) RULE=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=2
030768:
	make $(TARGET) RULE=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=2
030769:
	make $(TARGET) RULE=T  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=2
030770:
	make $(TARGET) RULE=I  ROW=1 NOEIS=$@ LEN=2000     ORD=do P1=2
030771:
	make $(TARGET) RULE=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=2
030772:
	make $(TARGET) RULE=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=2
030773:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=2 P2=1
030774:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=2 P2=2
030775:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=2 P2=3
030776:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=2 P2=4

030777:
	make $(TARGET) RULE=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=3
030778:
	make $(TARGET) RULE=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=3
030779:
	make $(TARGET) RULE=T  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=3
030780:
	make $(TARGET) RULE=I  ROW=1 NOEIS=$@ LEN=2000     ORD=do P1=3
030781:
	make $(TARGET) RULE=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=3
030782:
	make $(TARGET) RULE=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=3
030783:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=3 P2=1
030784:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=3 P2=2
030785:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=3 P2=3
030786:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=3 P2=4

030787:
	make $(TARGET) RULE=A  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=4
030788:
	make $(TARGET) RULE=A  ROW=2 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=4
030789:
	make $(TARGET) RULE=T  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=4
030790:
	make $(TARGET) RULE=I  ROW=1 NOEIS=$@ LEN=2000     ORD=do P1=4
030791:
	make $(TARGET) RULE=J  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=4
030792:
	make $(TARGET) RULE=K  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=4
030793:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=4 P2=1
030794:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=4 P2=2
030795:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=4 P2=3
030796:
	make $(TARGET) RULE=P  ROW=1 NOEIS=$@ LEN=$(LIMIT) ORD=do P1=4 P2=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 $(TARGET) RULE=B  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=0
055169:
	make $(TARGET) RULE=N  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=0
055170:
	make $(TARGET) RULE=D  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=0
055171:
	make $(TARGET) RULE=B  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=1
055172:
	make $(TARGET) RULE=N  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=1
055173:
	make $(TARGET) RULE=D  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=1
055174:
	make $(TARGET) RULE=B  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=2
055175:
	make $(TARGET) RULE=N  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=2
055176:
	make $(TARGET) RULE=D  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=2
055177:
	make $(TARGET) RULE=B  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=3
055178:
	make $(TARGET) RULE=N  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=3
055179:
	make $(TARGET) RULE=D  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=3
055180:
	make $(TARGET) RULE=B  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=4
055181:
	make $(TARGET) RULE=N  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=4
055182:
	make $(TARGET) RULE=D  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=4
055183:
	make $(TARGET) RULE=B  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=5
055184:
	make $(TARGET) RULE=N  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=5
055185:
	make $(TARGET) RULE=D  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=5
#-----
05518n: 055186 055187 \
		055188 055189 055190 055191
055186:
	make $(TARGET) RULE=A  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=iz P1=0
055187:
	make $(TARGET) RULE=A  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=io P1=1
055188:
	make $(TARGET) RULE=A  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=2
055189:
	make $(TARGET) RULE=A  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=3
055190:
	make $(TARGET) RULE=A  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=4
055191:
	make $(TARGET) RULE=A  ROW=0 NOEIS=$@ LEN=$(LIMIT) ORD=fa P1=5
#----------
2177_list:
	grep -aE "^A2177" ../names
2177nn: 217760 217780 #	ok
217760: # c.f. 055186
	make $(TARGET) RULE=A  ROW=0 NOEIS=$@ LEN=10000    ORD=fa P1=0
217780: # c.f. 055187
	make $(TARGET) RULE=A  ROW=0 NOEIS=$@ LEN=10000    ORD=fa P1=1
#---------------------------------------------------------------
cumulcount:
	# -------------------------------------------------------
	test -s b$(NOEIS).txt || wget http://oeis.org/A$(NOEIS)/b$(NOEIS).txt
	perl $(TARGET).pl $(RULE) $(ROW) $(NOEIS) $(LEN) $(ORD) $(P1) $(P2) > A$(NOEIS).pn.tmp
	grep -E "^[0-9]" b$(NOEIS).txt    | head -n $(LEN)                           > bf.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 || :
#--------
list1:
	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 \
	| sed -e "s/\.0/  /" -e "s/ 0 0/.0  /" -e "s/ 0/  /" -e "s/\.0/ 0/" \
	| tee listing.tmp
	wc -l listing.tmp
#----

Results and Problems

The makefile currently generates and compares all 116 sequences in the list. Only a few problems were found:

  1. A030717 (row 1) does not correspond with the derived sequences and 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.
  • 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.