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-7 of 7 results.

A330334 Number of times A329985(n) has appeared in A329985 (including the present occurrence).

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Dec 16 2019

Keywords

Crossrefs

Cf. A329985.

A358921 a(1) = 1; a(n) is the smallest positive number not among the terms a(n-c .. n-1) where c = the number of times a(n-1) has occurred.

Original entry on oeis.org

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

Views

Author

Samuel Harkness, Dec 06 2022

Keywords

Comments

A new number other than 1 is always followed by a 1, so a(n) < n/2 for n > 4.

Examples

			For a(6), a(5) = 1 has occurred 3 times, so the smallest positive integer not in {a(5), a(4), a(3)} = {1, 3, 1} is 2, thus a(6) = 2.
Next, for a(7), a(6) = 2 has occurred 2 times, so the smallest positive integer not in {a(6), a(5)} = {2, 1} is 3, thus a(7) = 3.
Then, for a(8), a(7) = 3 has occurred 2 times, so the smallest positive integer not in {a(7), a(6)} = {3, 2} is 1, thus a(8) = 1.
Now, for a(9), a(8) = 1 has occurred 4 times, so the smallest positive integer not in {a(8), a(7), a(6), a(5)} = {1, 3, 2, 1} is 4, thus a(9) = 4.
The first terms, alongside the number of times they have occurred o(n), are:
  n  a(n)  o(n)
  -  ----  ----
  1     1     1
  2     2     1
  3     1     2
  4     3     1
  5     1     3
  6     2     2
  7     3     2
  8     1     4
  9     4     1
  10    1     5
		

Crossrefs

Programs

  • Mathematica
    V = {1} While[Length[V] < 84, b = 1; While[MemberQ[Take[V, -Count[V, Last[V]]], b], b++ ]; AppendTo[V, b]]; Print[V]
  • PARI
    { a = o = vector(84); v = 1; for (n=1, #a, print1 (a[n]=v", "); v=setminus([1..n+1], Set(a[n-o[a[n]]+++1..n]))[1]) } \\ Rémy Sigrist, Jan 09 2023

A329981 a(1) = 0, and for n > 0, a(n+1) = floor(k / 3) where k is the number of terms equal to a(n) among the first n terms.

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 2, 0, 2, 0, 2, 1, 2, 1, 2, 1, 3, 0, 2, 2, 2, 2, 3, 0, 3, 1, 3, 1, 3, 1, 4, 0, 3, 2, 3, 2, 3, 2, 4, 0, 3, 3, 3, 3, 4, 1, 4, 1, 4, 1, 5, 0, 4, 2, 4, 2, 4, 2, 5, 0, 4, 3, 4, 3, 4, 3, 5, 1, 5, 1, 5, 1, 6, 0, 4, 4, 4, 4, 5, 2, 5, 2
Offset: 1

Views

Author

Rémy Sigrist, Nov 26 2019

Keywords

Comments

In other words, for n > 0, a(n+1) = floor(o(n) / 3) where o is the ordinal transform of the sequence.
Every nonnegative number appears infinitely many times in the sequence.
The second difference of the positions of the zeros in the sequence appears to be eventually 6-periodic.

Examples

			The first terms, alongside their ordinal transform, are:
  a   a(n)  o(n)
  --  ----  ----
   1     0     1
   2     0     2
   3     0     3
   4     1     1
   5     0     4
   6     1     2
   7     0     5
   8     1     3
   9     1     4
  10     1     5
  11     1     6
  12     2     1
		

Crossrefs

See A329982, A329984, A329985 and A330004 for similar sequences.

Programs

  • PARI
    o = vector(7); v=0; for (n=1, 87, print1 (v", "); v=o[1+v]++\3)

A354971 a(1)=1, a(2)=0; for n > 2, a(n) is the number of times a(n - 1 - a(n-1)) has appeared in the sequence.

Original entry on oeis.org

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

Views

Author

Neal Gersh Tolunsky, Jun 14 2022

Keywords

Comments

Conjecture: every positive integer eventually appears in the sequence.
Conjecture: The longest run of same, consecutive a(n) is 4 terms.
A003056 can be generated using the same rules but starting with 0.

Examples

			For n=9, a(9) is the number of times a(9 - 1 - a(9-1)) = a(8 - a(8)) = a(3) = 1 has appeared in the sequence, so a(9)=5.
		

Crossrefs

Programs

A337835 a(1) = 0 and for n > 1, a(n+1) = k - a(n) where k is the number of terms equal to a(n) among the first n terms.

Original entry on oeis.org

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

Views

Author

Bence Bernáth, Nov 17 2020

Keywords

Comments

Empirical observation: -A000194(n) <= a(n) <= A000194(n).

Examples

			For n = 4, a(4) = 2, which appeared only once in the sequence so a(5)=1-2=-1.
		

Crossrefs

Programs

  • MATLAB
    length=1000;
    sequence(1)=0;
    for n=2:1:length
            sequence(n)=nnz(sequence==sequence(end))-sequence(n-1);
    end
    
  • Mathematica
    a = {0}; Do[AppendTo[a, Count[a, a[[-1]]] - a[[-1]]], {100}]; a (* Amiram Eldar, Nov 18 2020 *)
    a[1] = 0; a[n_Integer?Positive] := a[n] = Count[Array[a, n - 1], a[n - 1]] - a[n - 1]; Array[a, 101] (* Jan Mangaldan, Nov 27 2020 *)
  • PARI
    lista(nn) = {my(va = vector(nn)); for (n=2, nn, va[n] = #select(x->(x==va[n-1]), vector(n-1, k, va[k])) - va[n-1];); va;} \\ Michel Marcus, Nov 18 2020
    
  • Python
    from itertools import islice
    from collections import Counter
    def agen(): # generator of terms
        an, k = 0, Counter()
        while True:
            yield an
            k[an] += 1
            an = k[an] - an
    print(list(islice(agen(), 86))) # Michael S. Branicky, Nov 12 2022

A363083 a(0)=a(1)=1. For n>1, if the number of occurrences of a(n-1) is less than abs(a(n-1)), then a(n)=a(n-1)-a(n-2). Otherwise, a(n)=a(n-1)+a(n-2).

Original entry on oeis.org

1, 1, 2, 1, 3, 2, 5, 3, -2, -5, -3, 2, -1, 1, 0, 1, 1, 2, 3, 5, 2, 7, 5, -2, 3, 1, 4, 3, 7, 4, -3, -7, -4, 3, -1, 2, 1, 3, 4, 1, 5, 4, 9, 5, 14, 9, -5, -14, -9, 5, -4, -9, -5, 4, -1, 3, 2, 5, 7, 2, 9, 7, -2, 5, 3, 8, 5, 13, 8, -5, -13, -8, 5, -3, 2, -1, 1, 0
Offset: 0

Views

Author

Gavin Lupo, May 18 2023

Keywords

Examples

			a(0) = 1
a(1) = 1
a(2) = 2. Two 1's in the list so far.    2 > abs(1).   1 + 1 = 2.
a(3) = 1. One 2 in the list so far.      1 < abs(2).   2 - 1 = 1.
a(4) = 3. Three 1's in the list so far.  3 > abs(1).   1 + 2 = 3.
		

Crossrefs

Programs

  • Python
    from itertools import islice
    from collections import Counter
    def agen(): # generator of terms
        anprev, an, c = 1, 1, Counter([1])
        yield 1
        while True:
            yield an
            c[an] += 1
            anprev, an = an, an-anprev if c[an] < abs(an) else an+anprev
    print(list(islice(agen(), 80))) # Michael S. Branicky, May 18 2023

A337014 a(1) = 0 and for n > 1, a(n+1) = (k(n) - a(n))*(-1)^(n+1) where k(n) is the number of terms equal to a(n) among the first n terms.

Original entry on oeis.org

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

Views

Author

Bence Bernáth, Nov 21 2020

Keywords

Comments

The graph of the sequence shows interesting, "Christmas tree"-like shapes.

Examples

			For n = 4, a(4) = 2, which appeared only once before, so a(5)=(1-2)*(-1)^5 = 1.
		

Crossrefs

Programs

  • MATLAB
    length=10000;
    sequence(1)=0;
    for n=2:1:length
         sequence(n)=((nnz(sequence==sequence(end)))-(sequence(n-1)))*(-1)^n;
    end
    
  • Mathematica
    a = {0}; Do[AppendTo[a, (-1)^k*(Count[a, a[[-1]]] - a[[-1]])], {k, 0, 81}]; a (* Amiram Eldar, Nov 21 2020 *)
  • PARI
    { for (n=1, #a=vector(83), print1(a[n]=if (n==1, 0, k=sum(k=1, n-1, a[k]==a[n-1]); (k-a[n-1])*(-1)^n) ", ")) } \\ Rémy Sigrist, Nov 22 2020
    
  • Python
    from itertools import islice
    from collections import Counter
    def agen(): # generator of terms
        an, k, sign = 0, Counter(), -1
        while True:
            yield an
            k[an] += 1
            sign *= -1
            an = (k[an] - an)*sign
    print(list(islice(agen(), 83))) # Michael S. Branicky, Nov 12 2022
Showing 1-7 of 7 results.