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.

A347326 A347738 with rows normalized by subtracting each term in a row from the first term in the row.

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 2, 2, 3, 4, 0, 2, 4, 5, 5, 5, 7, 8, 8, 9, 9, 10, 0, 3, 7, 10, 11, 11, 13, 13, 12, 12, 13, 16, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 22, 0, 4, 11, 18, 22, 23, 25, 26, 25, 25, 27, 29, 30, 30, 29, 28, 28, 29, 31, 33, 35, 36, 39, 40, 41, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 46
Offset: 0

Views

Author

N. J. A. Sloane, Sep 13 2021

Keywords

Comments

As a result of the normalization, each row starts at 0 and is nondecreasing.
There was a possibility that the new rows would appear to be converging to something, although that is not apparent at present.

Examples

			Row 2 of A347738 is [4,3,2,2,1,0], and subtracting each term from the first term, 4, we get row 2 of the present sequence, [0, 1, 2, 2, 3, 4].
The first few normalized rows are:
[0],
[0, 0, 1],
[0, 1, 2, 2, 3, 4],
[0, 2, 4, 5, 5, 5, 7, 8, 8, 9, 9, 10],
[0, 3, 7, 10, 11, 11, 13, 13, 12, 12, 13, 16, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 22],
[0, 4, 11, 18, 22, 23, 25, 26, 25, 25, 27, 29, 30, 30, 29, 28, 28, 29, 31, 33, 35, 36, 39, 40, 41, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 46],
...
		

Crossrefs

Cf. A347738.

Programs

  • Python
    def aupton(nn):
        num, gte_inventory, bigc, row, alst = 0, [1], 0, [], [0]
        while len(alst) < nn + 1:
            c = gte_inventory[num] if num <= bigc else 0
            row.append(c)
            num += 1
            if c == 0:
                num = 0
                alst.extend([row[0] - row[i] for i in range(len(row))])
                row = []
            for i in range(min(c, bigc)+1):
                gte_inventory[i] += 1
            for i in range(bigc+1, c+1):
                gte_inventory.append(1)
            bigc = len(gte_inventory) - 1
        return alst
    print(aupton(92)) # Michael S. Branicky, Sep 19 2021

A347324 Row sums in A347738 when that sequence is written as a triangle.

Original entry on oeis.org

0, 2, 12, 48, 167, 541, 1692, 5187, 15700, 47030, 139986, 415385, 1230417, 3638657, 10744058, 31705658, 93563017, 276079102, 814408697, 2402076923, 7085491321, 20902994644, 61668276920, 181926014930, 536710980085, 1583529043750, 4672393755494, 13786612213841
Offset: 0

Views

Author

N. J. A. Sloane, Sep 13 2021

Keywords

Comments

Ratio of successive terms, a(n+1)/a(n), seems to be converging to ~2.9506. - Michael S. Branicky, Sep 19 2021

Examples

			Row 2 is 4,  3,  2,  2,  1,  0, which has sum 12.
		

Crossrefs

Cf. A347738, A003945 (row lengths).

Programs

  • Mathematica
    Total /@ TakeList[Import["https://oeis.org/A347738/b347738.txt", "Data"][[All, -1]], {1}~Join~Array[3*2^# &, 13, 0]] (* Michael De Vlieger, Sep 13 2021, generated using the b-file at A347738 *)
  • Python
    def afind():
        num, gte_inventory, rowsum, bigc = 0, [1], 0, 0
        print(0, end=", ")
        while True:
            c = gte_inventory[num] if num <= bigc else 0
            num += 1
            rowsum += c
            if c == 0:
                print(rowsum, end=", ")
                num = rowsum = 0
            for i in range(min(c, bigc)+1):
                gte_inventory[i] += 1
            for i in range(bigc+1, c+1):
                gte_inventory.append(1)
            bigc = len(gte_inventory) - 1
    afind() # Michael S. Branicky, Sep 19 2021

Extensions

a(14)-a(16) from Michael De Vlieger, Sep 13 2021
a(17)-a(27) from Michael S. Branicky, Sep 18 2021

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

A347791 Inventory sequence using prime divisors (with multiplicity): Record the number of terms thus far which are divisible by every prime, then the number of terms thus far not divisible by any prime, then the number divisible (once) by a single prime, then 2 (including with multiplicity), then 3 etc until a zero is recorded. Repeat after every zero term.

Original entry on oeis.org

0, 1, 1, 0, 2, 2, 2, 0, 3, 2, 5, 0, 4, 2, 7, 1, 0, 5, 3, 10, 2, 0, 6, 3, 12, 3, 1, 0, 7, 4, 14, 5, 1, 0, 8, 5, 16, 5, 2, 1, 0, 9, 6, 18, 7, 3, 1, 0, 10, 7, 21, 9, 3, 1, 0, 11, 8, 23, 10, 4, 1, 0, 12, 9, 24, 13, 5, 2, 0, 13, 9, 28, 14, 6, 2, 0, 14, 9, 29, 18, 7
Offset: 0

Views

Author

David James Sycamore, Sep 13 2021

Keywords

Comments

Inspired by the original Inventory sequence (A342585). It follows from the definition that zero appears infinitely many times. Every nonzero number number appears because the number of zero terms increments at every extension of the sequence between consecutive zeros. Since the count for each number of divisors increments (eventually) as the sequence extends, it follows that every number appears infinitely many times.
The count of terms divisible by every prime is the number of zeros, the count of terms divisible by no prime is the number of 1s, the count of terms divisible by one prime (once) is the number of primes, etc.

Examples

			a(0)=0 because at this point there are zero terms divisible by every prime. a(1)=1 because there is now one term (0) which is divisible by every prime. a(2)=1 because there is now one term (1) with no prime divisor. a(3)=0 because at this point there is no term divisible by one prime, and so on.
As an irregular triangle the sequence begins:
   0;
   1,  1,  0;
   2,  2,  2,  0;
   3,  2,  5,  0;
   4,  2,  7,  1,  0;
   5,  3, 10,  2,  0;
   6,  3, 12,  3,  1,  0;
   7,  4, 14,  5,  1,  0;
   8,  5, 16,  5,  2,  1,  0;
   9,  6, 18,  7,  3,  1,  0;
  10,  7, 21,  9,  3,  1,  0;
  11,  8, 23, 10,  4,  1,  0; etc.
		

Crossrefs

Programs

  • Mathematica
    Block[{a = {}, c, k, m}, c[-1] = 0; Do[k = -1; c[-1]++; AppendTo[a, 0]; While[IntegerQ[c[k]], AppendTo[a, c[k]]; Set[m, PrimeOmega[c[k]]]; If[IntegerQ[c[m]], c[m]++, Set[c[m], 1]]; k++], 10]; a] (* Michael De Vlieger, Sep 15 2021 *)

A352799 Inventory sequence of binary weights.

Original entry on oeis.org

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

Views

Author

David James Sycamore, Apr 03 2022

Keywords

Comments

Record the number of terms with binary weight zero, then successively record those with weights 1,2,... (including in the count the weights of new terms as they are recorded), until reaching a weight w for which there are zero terms with that weight, whereupon record a zero term. Repeat.

Examples

			a(0) = 0 because at the start there are no terms, therefore zero terms with binary weight zero.
a(1) = 1 because the first term (0) has binary weight zero and there is just one such term.
a(2) = 1 since a(1) = 1 has weight 1, and there is only one term with this weight.
a(3) = 0 since there are no terms with weight 2. Reset the count to zero weight and repeat.
a(4) = 2 because now there are 2 terms (a(0), a(3)) which have weight 0. And so on.
As an irregular triangle the sequence begins:
  0;
  1,  1, 0;
  2,  3, 1, 0;
  3,  4, 2, 0;
  4,  7, 2, 1, 0;
  5,  9, 4, 1, 0;
  6, 11, 5, 2, 0;
		

Crossrefs

Programs

Extensions

a(45) and beyond from Michael S. Branicky, Apr 03 2022

A348218 Variation on the Inventory Sequence A342585: record the number of previous terms which are divisible by the iterating number, starting at 1, until 0 is recorded, then restart the iterating number from 1. See the Comments.

Original entry on oeis.org

1, 1, 0, 2, 1, 0, 4, 2, 0, 6, 4, 1, 2, 0, 10, 7, 1, 2, 1, 1, 1, 0, 17, 8, 1, 3, 1, 1, 1, 1, 0, 25, 9, 3, 3, 2, 1, 1, 1, 1, 1, 0, 35, 10, 5, 3, 5, 1, 2, 1, 1, 2, 0, 45, 13, 7, 3, 7, 1, 4, 1, 2, 2, 0, 55, 16, 8, 6, 8, 2, 4, 4, 2, 2, 1, 0, 66, 26, 10, 9, 9, 3, 4, 4, 4, 3, 2, 0, 77, 32, 14, 13, 9, 3
Offset: 0

Views

Author

Scott R. Shannon, Oct 07 2021

Keywords

Comments

This sequence is a variation of A342585. Instead of iteratively counting the occurrences of each number starting from zero and then repeating when zero is recorded, we start the iterating number at 1 and count the previous terms that are divisible by that number. This number increases for each division until zero previous terms is recorded, when the iterating number is reset to one and the divisor count repeats. The sequence starts with a(0) = 1.
After 10^7 terms the largest value is a(9990262) = 9988674, which is a count of the terms >= 1. The largest value the iterating divisor has reached is 13249.

Examples

			a(1) = 1 as the iterating dividing number starts at 1, and so far there has been one term, a(0), which is divisible by 1.
a(2) = 0 as the dividing number has increased to two, but there have been no terms in the sequence so far that are divisible by 2. The dividing number is now reset to 1.
a(3) = 2 as there have been two terms, a(0) and a(1), that are divisible by 1.
a(4) = 1 as there has been one term, a(3), that is divisible by 2.
a(5) = 0 as there have been no terms divisible by 3. The dividing number is now reset to 1.
		

Crossrefs

A348288 Variation on the Inventory Sequence A342585: the same rules as A342585 are used except that the terms count the occurrences of the iterating number, treated as a string, in the string concatenation of all previous terms. See the Comments.

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, 4, 2, 0, 9, 10, 8, 5, 11, 6, 6, 2, 2, 4, 5, 3, 0, 11, 15, 10, 6, 12, 8, 8, 2, 4, 4, 6, 5, 1, 1, 1, 1, 3, 0, 13, 23, 13, 10, 14
Offset: 0

Views

Author

Scott R. Shannon, Oct 10 2021

Keywords

Comments

This is a variation of A342585. The same rules apply except that each number, as it iterates from counting zeros to counting the next number until zero occurrences are found, is treated as a string. The number of occurrences of this string is counted in the concatenation of all previous terms which is also treated as a string. For example when the sequence is adding the number of occurrences of 10, this is treated as the string '10', and thus any occurrence of '10' in the concatenation of all previous terms is counted. This would therefore count the term 1 followed by 0 as an occurrence of '10'. The strings are allowed to overlap, e.g., the number '111' would increment the count of 1's three times, the count of 11's two times, and the count of 111's one time.
Counting the occurrences of each number treated as a string leads to many more terms being found before a zero term is recorded. For example the iteration spanning the 5 millionth term has a(4989084) = 0, a(4989085) = 1059723, then a(5019089) = 2, a(5019090) = 0. Therefore at this stage every number, treated as a string, from 0 to 30005 has occurred at least once in the concatenation of all previous terms.
Unlike A342585 the number of occurrences of the smaller values does not seem to change order as n gets larger. After 5 million terms the order of most frequent occurrences is 1,2,3,4,5,6,7,8,9,0,11,12,10,21,13,14,15,16. It is unlikely the single-digit order changes although, considering that 21 appears high on the count for 2-digit numbers, the order of these and other 2-digit values may change as n gets larger. See the linked image.

Examples

			a(56) = 4. This is the first term that differs from A342585 as in that sequence no 10's have occurred after 55 terms. However in this sequence '10' can be formed by '1' followed by '0', and in the concatenation of terms a(0) to a(55) that has occurred four times, starting as a(2), a(12), a(26), a(35).
		

Crossrefs

Programs

  • Python
    def count_overlaps(subs, s):
        c = i = 0
        while i != -1:
            i = s.find(subs, i)
            if i != -1: c += 1; i += 1
        return c
    def aupton(terms):
        alst, astr, numtocount = [0], "0", 0
        for n in range(2, terms+1):
            c = count_overlaps(str(numtocount), astr)
            numtocount = 0 if c == 0 else numtocount + 1
            alst.append(c)
            astr += str(c)
        return alst
    print(aupton(95)) # Michael S. Branicky, Oct 10 2021

A383967 Inventory sequence recording number of terms with 1,2,3,... decimal digits. Count until occurrence of a term = 0, whereupon reset the count; continue.

Original entry on oeis.org

0, 1, 0, 3, 0, 5, 0, 7, 0, 9, 0, 11, 1, 0, 13, 2, 0, 15, 3, 0, 17, 4, 0, 19, 5, 0, 21, 6, 0, 23, 7, 0, 25, 8, 0, 27, 9, 0, 29, 10, 0, 30, 12, 0, 31, 14, 0, 32, 16, 0, 33, 18, 0, 34, 20, 0, 35, 22, 0, 36, 24, 0, 37, 26, 0, 38, 28, 0, 39, 30, 0, 40, 32, 0, 41, 34
Offset: 1

Views

Author

David James Sycamore, May 16 2025

Keywords

Examples

			a(1) = 0 because at first there are no terms with just one decimal digit. Following a zero term the count is reset and now since there is one term (a(1) = 0) with just one digit, a(2) = 1. Since there are no terms with two digits a(3) = 0. The count resets again and a(4) = 3 because there are now three terms (0,1,0) which have only one digit. Since there are no terms with two digits a(5) = 0.
The sequence continues 0,1,0,3,0,5,0,7,0,9,0 and at this point we have 11 terms with one digit then one term (11) with two digits, so the next two terms are 11,1 followed by 0 since there is not yet a term with three digits; and so on.
		

Crossrefs

Programs

  • Mathematica
    nn = 120; q[] := 0; f[x] := If[x == 0, 1, IntegerLength[x]]; j = 0; c = 1; q[1]++; {j}~Join~Reap[Do[If[j == 0, c = 1]; j = Sow[q[c]]; c++; q[f[j]]++, nn - 1] ][[-1, 1]] (* Michael De Vlieger, Jun 01 2025 *)
Showing 1-8 of 8 results.