cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-8 of 8 results.

A126027 Row lengths for A333867.

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 8, 11, 15, 18, 20, 23, 25, 30, 38, 49, 62, 77, 94, 110, 129, 149, 172, 195, 218, 241, 266, 293, 323, 356, 389, 424, 461, 500, 545, 593, 641, 688, 737, 787, 839, 896, 957, 1021, 1085, 1152, 1219, 1291, 1368, 1447, 1527, 1611, 1697
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

Formula

a(n+1) = max_{k=1..a(n)} A333867(n,k).

A253170 Row sums of table A333867.

Original entry on oeis.org

1, 1, 2, 3, 5, 7, 10, 13, 17, 22, 28, 35, 42, 50, 60, 72, 85, 101, 119, 139, 162, 187, 215, 246, 279, 315, 353, 394, 437, 482, 529, 579, 632, 688, 748, 810, 875, 944, 1016, 1094, 1177, 1263, 1351, 1443, 1538, 1637, 1742, 1852, 1966, 2083, 2205, 2330, 2460
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 28 2014

Keywords

Crossrefs

Cf. A333867, A126027, A030719 (first differences).

Programs

  • Haskell
    a253170 = sum . a333867_row

A342585 Inventory sequence: record the number of zeros thus far in the sequence, then the number of ones thus far, then the number of twos thus far and so on, until a zero is recorded; the inventory then starts again, recording the number of zeros.

Original entry on oeis.org

0, 1, 1, 0, 2, 2, 2, 0, 3, 2, 4, 1, 1, 0, 4, 4, 4, 1, 4, 0, 5, 5, 4, 1, 6, 2, 1, 0, 6, 7, 5, 1, 6, 3, 3, 1, 0, 7, 9, 5, 3, 6, 4, 4, 2, 0, 8, 9, 6, 4, 9, 4, 5, 2, 1, 3, 0, 9, 10, 7, 5, 10, 6, 6, 3, 1, 4, 2, 0, 10, 11, 8, 6, 11, 6, 9, 3, 2, 5, 3, 2, 0, 11, 11, 10
Offset: 1

Views

Author

Joseph Rozhenko, Mar 16 2021

Keywords

Comments

To get started we ask: how many zero terms are there? Since there are no terms in the sequence yet, we record a '0', and having recorded a '0', we begin again: How many zero terms are there? There is now one 0, so we record a '1' and continue. How many 1's are there? There's currently one '1' in the sequence, so we record a '1' and continue. How many 2's are there? There are no 2's yet, so we record a '0', and having recorded a 0, we begin again with the question "how many zero terms are there?" And so on.
a(46) = 0 because no 8's appear before it; but note a higher number, namely 9, has appeared. - Michael S. Branicky, Mar 16 2021
A similar situation occurs at n=124, where 14 has not yet appeared in the sequence, although 15 has appeared.
Reminiscent of Van Eck's sequence A181391. - N. J. A. Sloane, May 02 2021
From Jan Ritsema van Eck, May 02 2021: (Start)
The first 1000 terms seem to grow more or less in saw-tooth fashion with the largest terms (= the number of 0's), as well as the distance between the 0's, both approximately equal to the inverse triangular numbers A003056 (see attached graph #1).
But the picture changes when we go out to 10000 terms. Around the 1700th term, the 1's become more frequent than the 0's and the largest values are consistently somewhat larger than the inverse triangular numbers. Around the 2500th term the 2's become the most frequent number. Also after some 4000 terms, the largest values become much larger than the inverse triangular numbers. See graph #2. (End)
Comment on the colored plot of the first 1000467 terms, from Hans Havermann, May 02 2021: (Start)
If one is drawing a points-joined graph, it will obscure some of the inherent large-number dynamics. To get around that, this plot joins the points with a green line, superimposing the actual points in blue. This plot was created by Mathematica.
Your browser will likely compress the very large image to window size, so click on it to expand.
The points fall into linear features of the various counts of the various integers. The count for each integer changes as we move towards infinity and hence crosses over (changes place with) other counts unpredictably.
I decided to chart (see the blue text) the twenty largest counts at the rightmost spike which runs from the zero at 997010 to the zero at 1000467. These largest values are for the counts of integers 2 to 21 and appear at a(997013) for the 2-count; a(997014) for the 3-count, ..., and a(997032) for the 21-count.
The counts are 15275, 26832, 40162, 48539, 56364, 54372, 53393, 43588, 37288, 27396, 22425, 16735, 13099, 11460, 9466, 8386, 7191, 6478, 5777, and 5208, respectively. In my text they are sorted largest-to-smallest and written "count @ integer-being-counted": 56364 @ 6, 54372 @ 7, 53393 @ 8, 48539 @ 5, ... 5208 @ 21. (End)
A useful view may be gained by plotting the sequence against itself with an offset. Using the "Plot 2" link in the web page footer, enter "A342585" as sequences 1 and 2. Select "Plot Seq2(n+shift) vs Seq1(n)" and "Draw line segments". Start with "1" as the shift. The sequence appears somewhat like a fan, the first 4 or 5 sectors showing clearly, later sectors overlying each other. Larger shift values effectively compress early sectors into the vertical axis, making later sectors more visible. - Peter Munn, May 08 2021
For a version where a row ends not at the first zero, but rather at the last zero, see A347317. - N. J. A. Sloane, Sep 10 2021
For n around 2.5*10^9, the upper envelope of the sequence seems to be growing roughly like n/50, or maybe like O(n/log(n)). - N. J. A. Sloane, Feb 10 2023

Examples

			As an irregular triangle this begins:
   0;
   1,  1,  0;
   2,  2,  2,  0;
   3,  2,  4,  1,  1,  0;
   4,  4,  4,  1,  4,  0;
   5,  5,  4,  1,  6,  2,  1,  0;
   6,  7,  5,  1,  6,  3,  3,  1,  0;
   7,  9,  5,  3,  6,  4,  4,  2,  0;
   8,  9,  6,  4,  9,  4,  5,  2,  1,  3,  0;
   9, 10,  7,  5, 10,  6,  6,  3,  1,  4,  2,  0;
  10, 11,  8,  6, 11,  6,  9,  3,  2,  5,  3,  2,  0;
  ...
For row lengths see A347299. - _N. J. A. Sloane_, Aug 27 2021
From _David James Sycamore_, Oct 18 2021: (Start)
a(1) is 0 because the count is reset, and as yet there is no zero term immediately following another term. a(2) = 1 since the count is reset, a(1) = 0 and a(0) precedes it. The count now increments to terms equal to 1.
a(3) = 1 since a(2) = 1 and a(1) precedes it. a(4) = 0 because there is no term equal to 2 which is immediately preceded by another term.
a(5) = 2 since the count is reset, a(1) = a(4) = 0 and a(0), a(3) respectively, precede them. (End)
		

Crossrefs

Records: A347305 and A348782.
Other inventory-type sequences: A030717, A174382, A333867, A358066, A357443, A356784.
A012257 (cf. also A011784) reverses the inventory process.
See A347062, A347738, A355916, A355917, A355918, A357317 for variants.

Programs

  • AWK
    # See Links section. - Luc Rousseau, May 02 2021
    
  • MATLAB
    function [val,arr]=invSeq(N) % val = Nth term, arr = whole array up to N
    k=0;
    arr=zeros(1,N); % pre-allocate array
    for i=1:N
        an=sum((k==arr(2:i)));
        arr(i)=an;
        if an == 0
            k = 0;
        else
            k=k+1;
        end
    end
    val=arr(end);
    end % Ben Cha, Nov 11 2022
    
  • Maple
    a:= proc(n) option remember; local t;
          t:= `if`(a(n-1)=0, 0, b(n-1)+1);
          b(n):=t; add(`if`(a(j)=t, 1, 0), j=1..n-1)
        end: b(1), a(1):= 0$2:
    seq(a(n), n=1..120);  # Alois P. Heinz, Mar 16 2021
  • Mathematica
    a[n_] := a[n] = Module[{t}, t = If[a[n-1] == 0, 0, b[n-1]+1];
         b[n] = t; Sum[If[a[j] == t, 1, 0], {j, 1, n-1}]];
    b[1] = 0; a[1] = 0;
    Array[a, 120] (* Jean-François Alcover, May 03 2021, after Alois P. Heinz *)
  • PARI
    A342585_vec(N,c=[],i)=vector(N,j, while(#c<=i||#c<=c[i+1], c=concat(c,0)); c[i+=1]+if(c[1+c[i]]++&&!c[i]||j==1,i=0)) \\ M. F. Hasler, Nov 13 2021
    
  • PARI
    \\ See Links section.
    
  • Python
    def calc(required_value_number):
        values_lst = []
        current_count = 0
        new_value = 0
        for i in range(required_value_number):
            new_value = values_lst.count(current_count)
            values_lst.append(new_value)
            if new_value == 0:
                current_count = 0
            else:
                current_count += 1
        return new_value # Written by Gilad Moyal
    
  • Python
    from collections import Counter
    def aupton(terms):
      num, alst, inventory = 0, [0], Counter([0])
      for n in range(2, terms+1):
        c = inventory[num]
        num = 0 if c == 0 else num + 1; alst.append(c); inventory.update([c])
      return alst
    print(aupton(84)) # Michael S. Branicky, Jun 12 2021
    
  • R
    # Prints the first 10,068 terms
    library("dplyr")
    options(max.print=11000)
    inventory <- data.frame(1, 0)
    colnames(inventory) <- c("n", "an")
    value_to_count = 0
    n = 1
    for(x in 1:128) # Increase the 128 for more terms. The number of terms
                    # given is on the order of x^1.9 in the region around 128.
      {
      status <- TRUE
      while(status)
        {
        count <- length(which(inventory$an == value_to_count))
        n = n + 1
        inventory <- rbind(inventory, c(n, count))
        status <- isTRUE(count != 0)
        value_to_count = value_to_count + 1
        }
      value_to_count = 0
      }
    inventory # Damon Lay, Nov 10 2023

A030717 The first list after the following procedure: starting with a list [1] and an empty list, repeatedly add the distinct values already in the first list in ascending order to the second list and add the corresponding frequencies of those values to the first list.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

The clarifying comment that follows refers to the old name, which was: Row 1, where, at stage k>1, write i in row 1 and j in row 2, where i is the number of j's in row 1, for j=1,2,...,m, where m=max number in row 1 from stages 1 to k-1; state 1 is 1 in row 1.
Numbers j for which the count is 0 are omitted, cf. A333867 for the corresponding sequence where they are included. - Sean A. Irvine, Apr 08 2020

Examples

			First list begins:
  1;
  1;
  2;
  2, 1;
  3, 2;
  3, 3,  1;
  4, 3,  3;
  4, 3,  5, 1;
  5, 3,  6, 2, 1;
  6, 4,  7, 2, 2, 1;
  7, 6,  7, 3, 2, 2, 1;
  8, 8,  8, 3, 2, 3, 3;
  8, 9, 11, 3, 2, 3, 3, 3;
		

Crossrefs

Cf. A030718 (2nd list), A030719 (row lengths), A006920.
Cf. A030707 (repeatedly adds values and frequencies from both lists).
Cf. A333867 (0 counts included, but not the counts of 0s).

Programs

  • Mathematica
    t = {{1}}; Do[AppendTo[t, BinCounts[#, {1, Max[#] + 1}] &[Flatten[t]]], {25}];
    DeleteCases[Flatten[t], 0]  (* Peter J. C. Moses, Apr 09 2020 *)

Extensions

More terms from Franklin T. Adams-Watters, Dec 14 2006
Rolled back to original definition and data by Sean A. Irvine, Apr 08 2020
Name revised in line with A030777 by Peter Munn, Oct 11 2022

A079668 Start with 1; at n-th step, write down what is in the sequence so far.

Original entry on oeis.org

1, 1, 1, 3, 1, 4, 1, 0, 2, 1, 3, 1, 0, 6, 1, 1, 2, 2, 3, 1, 4, 2, 0, 10, 1, 3, 2, 3, 3, 2, 4, 0, 5, 1, 6, 4, 0, 12, 1, 6, 2, 6, 3, 3, 4, 1, 5, 2, 6, 0, 7, 0, 8, 0, 9, 1, 10, 8, 0, 15, 1, 8, 2, 8, 3, 5, 4, 2, 5, 5, 6, 1, 7, 1, 8, 1, 9, 2, 10, 0, 11, 1, 12, 10
Offset: 1

Views

Author

N. J. A. Sloane Jan 26 2003

Keywords

Comments

After 1 1 1 3 1, we see "4 1's, 0 2's and 1 3", so next terms are 4 1 0 2 3 1.

Examples

			Row n lists all terms written at the n-th step:
  1;
  1, 1;
  3, 1;
  4, 1,  0, 2, 1, 3;
  1, 0,  6, 1, 1, 2, 2, 3, 1, 4;
  2, 0, 10, 1, 3, 2, 3, 3, 2, 4, 0, 5, 1, 6;
  4, 0, 12, 1, 6, 2, 6, 3, 3, 4, 1, 5, 2, 6, 0, 7, 0, 8, 0, 9, 1, 10;
  ...
		

Crossrefs

For other versions see A051120, A055186, A079686.

Programs

  • Maple
    b:= proc(n) option remember; `if`(n<1, 0, b(n-1)+add(x^i, i=T(n))) end:
    T:= proc(n) option remember; `if`(n=1, 1, (p->
          seq([coeff(p, x, i), i][], i=ldegree(p)..degree(p)))(b(n-1)))
        end:
    seq(T(n), n=1..10);  # Alois P. Heinz, Aug 24 2025
  • Mathematica
    s={1}; Do[s=Flatten[{s,{Count[s,#],#}&/@Range[Min[s],Max[s]]}],{20}];s (* Peter J. C. Moses, Mar 21 2013 *)
  • Python
    from itertools import islice
    def agen(): # generator of terms
        a = [1]
        yield 1
        while True:
            counts = []
            for d in range(min(a), max(a)+1):
                c = a.count(d)
                counts.extend([c, d])
            a += counts
            yield from counts
    print(list(islice(agen(), 84))) # Michael S. Branicky, Aug 24 2025

Extensions

More terms from Sean A. Irvine, Aug 24 2025

A174382 T(1,0)=0 and for n > 1, T(n,k) is the number of k's in rows 1 to n - 1.

Original entry on oeis.org

0, 1, 1, 1, 1, 3, 1, 4, 0, 1, 2, 6, 0, 1, 1, 3, 8, 1, 1, 1, 0, 1, 4, 12, 1, 2, 1, 0, 1, 0, 1, 6, 16, 2, 2, 2, 0, 1, 0, 1, 0, 0, 0, 1, 11, 19, 5, 2, 2, 0, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 19, 22, 8, 2, 2, 1, 2, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 27, 28, 11, 2, 2, 1, 2, 0, 2, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 2, 0, 0, 1
Offset: 1

Views

Author

Keywords

Comments

Construction as in A333867 but starting with a 0 and including a count of 0s at the start of each row. [Edited by Peter Munn, Oct 11 2022]
See A342585 for a similarly defined sequence that has been analyzed more and has lists of other related sequences. - Peter Munn, Oct 08 2022

Examples

			0;
1; # one zero
1,1; # one zero, one one
1,3; # one zero, three ones
1,4,0,1; # one zero, four ones, zero twos, one three
		

Crossrefs

Cf. A240508 (row lengths).

Programs

  • Haskell
    import Data.List (sort, group)
    a174382 n k = a174382_tabf !! (n-1) !! k
    a174382_row n = a174382_tabf !! (n-1)
    a174382_tabf = iterate f [0] where
       f xs = g (xs ++ [0, 0 ..]) [0..] (map head zs) (map length zs)
         where g   _ [] = []
               g (u:us) (k:ks) hs'@(h:hs) vs'@(v:vs)
                 | k == h = u + v : g us ks hs vs
                 | k /= h = u : g us ks hs' vs'
               zs = group $ sort xs
    -- Reinhard Zumkeller, Apr 06 2014
  • Maple
    b:= proc(n) option remember; `if`(n<1, 0, b(n-1)+add(x^i, i=T(n))) end:
    T:= proc(n) option remember; `if`(n=1, 0, (p->
          seq(coeff(p, x, i), i=0..degree(p)))(b(n-1)))
        end:
    seq(T(n), n=1..12);  # Alois P. Heinz, Aug 25 2025

A006920 At each step, record how many 1's, 2's, etc. have been seen so far in the sequence.

Original entry on oeis.org

1, 1, 2, 21, 32, 331, 433, 4351, 53621, 647221, 7673221, 8883233, 891132333, 8101532334101, 101118423351110001, 141220533351220001001, 17142355335122101100101, 23162558335122102101101001, 30192751033612210211110100201, 3823295114361321021111110020101001
Offset: 1

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

A333867 is the tabular version of this sequence.

Extensions

More terms from Franklin T. Adams-Watters, Dec 14 2006

A139124 Starting from 1, at any step count the appearances of k, where k ranges from the highest number to 1.

Original entry on oeis.org

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

Views

Author

Keywords

Examples

			Start from 1. There is just one 1. So the sequence becames 1,1. Then count two 1s.
So we have 1,1,2. Then one 2 and two 1 -> 1,1,2,1,2. Then two 2 and three 1 -> 1,1,2,1,2,2,3. Then one 3, three 2, three 1 -> 1,1,2,1,2,2,3,1,3,3. Then three 3, three 2 and four 1 -> 1,1,2,1,2,2,3,1,3,3,3,3,4. And so on.
		

Crossrefs

Programs

  • Mathematica
    s={1};Do[si={};Do[j=Max[s]-i+1;AppendTo[si,Count[s,j]],{i,Max[s]}];s=AppendTo[s,si]//Flatten,{n,15}];s (* James C. McMahon, Jun 29 2025 *)

Extensions

a(87)-a(89) inserted by James C. McMahon, Jun 29 2025
Showing 1-8 of 8 results.