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.

User: Clément Vovard

Clément Vovard's wiki page.

Clément Vovard has authored 3 sequences.

A358338 a(n) = abs(a(n-1) - count(a(n-1))) where count(a(n-1)) is the number of times a(n-1) has appeared so far in the sequence, a(1)=0.

Original entry on oeis.org

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

Author

Clément Vovard, Nov 10 2022

Keywords

Comments

This sequence is related to the inventory sequence (A342585) as it uses the number of times a number has occurred so far in the sequence.
The following comments are only empirical observations:
ceiling(sqrt(2n)) is an excellent envelope of a(n) with no exceptions found in the first 50000 terms.
When x > 3 appears for the first time, it seems to always be preceded by a 1 and followed by x-1. Also, x-1 will already have occurred earlier in the sequence (new highest terms grow by 1).
The number of times x > 0 appears in the first k terms seems to approximately equal sqrt(2k)-x-1. Therefore, 1 appears approximately sqrt(2k) times. The highest term that has appeared in k terms is then approximately sqrt(2k), which also makes sense considering the number of times 1 appears and the fact that a new number is preceded by 1. The only exception is 0, which appears approximately sqrt(2k)/2 times.

Examples

			For n=2, a(2-1)=0 and 0 has occurred 1 time so far so a(2)=abs(0-1)=1.
For n=12, a(12-1)=1 and 1 has occurred 4 times so far so a(12)=abs(1-4)=3.
		

Crossrefs

Programs

  • Python
    from collections import Counter
    def aupton(terms):
        alst, inventory = [0], Counter([0])
        for n in range(2, terms+1):
            c = abs(alst[-1] - inventory[alst[-1]])
            alst.append(c); inventory[c] += 1
        return alst
    print(aupton(85)) # Michael S. Branicky, Nov 10 2022

A343299 a(n) = n + A000120(a(n-1)) - a(n-1), with n > 1, a(1) = 1, where A000120(x) is the binary weight of x.

Original entry on oeis.org

1, 2, 2, 3, 4, 3, 6, 4, 6, 6, 7, 8, 6, 10, 7, 12, 7, 14, 8, 13, 11, 14, 12, 14, 14, 15, 16, 13, 19, 14, 20, 14, 22, 15, 24, 14, 26, 15, 28, 15, 30, 16, 28, 19, 29, 21, 29, 23, 30, 24, 29, 27, 30, 28, 30, 30, 31, 32
Offset: 1

Author

Clément Vovard, Apr 11 2021

Keywords

Comments

The 'crossings' that appear in the graph seem to occur when a(n) is a power of 2.

Examples

			a(2) = 2 + A000120(1) - 1 = 2 + 1 - 1 = 2.
a(6) = 6 + A000120(4) - 4 = 6 + 1 - 4 = 3.
		

Crossrefs

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = n + DigitCount[a[n - 1], 2, 1] - a[n - 1]; Array[a, 100] (* Amiram Eldar, Apr 12 2021 *)
  • PARI
    lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, va[n] = n + hammingweight(va[n-1]) - va[n-1];); va;} \\ Michel Marcus, Apr 12 2021

Formula

a(n) = n - A011371(a(n-1)).

A339141 a(n) = reverse(10*n - a(n-1)), with n>1, a(1) = 1.

Original entry on oeis.org

1, 91, -16, 65, -51, 111, -14, 49, 14, 68, 24, 69, 16, 421, -172, 233, -36, 612, -224, 424, -412, 236, -6, 642, -293, 355, -58, 833, -345, 546, -632, 259, 17, 323, 72, 882, -215, 595, -502, 209, 102, 813, -383, 328, 221, 932, -264, 447, 34, 664, -451
Offset: 1

Author

Clément Vovard, Nov 25 2020

Keywords

Comments

Note that for x<0, reverse(x) is defined by -1*reverse(-x).
Starting the sequence with other numbers also gives similar-looking graphs.

Examples

			For n = 2, 10*n = 10*2 = 20, 20 - a(n-1) = 20 - 1 = 19, reverse(19) = 91.
For n = 3, 10*n = 10*3 = 30, 30 - a(3-1) = 30 - 91 = -61, reverse(-61) = -16.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, n, (p-> signum(p)* (f->
          parse(cat(f[-i]$i=1..length(f))))(""||(abs(p))))(10*n-a(n-1)))
        end:
    seq(a(n), n=1..60);  # Alois P. Heinz, Jan 06 2021
  • Mathematica
    nmax=51; a[1]=1; a[n_]:=Sign[10n-a[n-1]]IntegerReverse[10n-a[n-1]]; Table[a[n],{n,nmax}] (* Stefano Spezia, Dec 05 2020 *)
  • PARI
    rev(n) = sign(n)*fromdigits(Vecrev(digits(n)));
    a(n) = if (n==1, 1, rev(10*n-a(n-1))); \\ Michel Marcus, Dec 05 2020

Formula

a(n) = reverse(10*n - a(n-1)) where reverse means reverse the order of the digits.