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.

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

Views

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)).