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

A338209 a(1) = 1, a(n) is the least m not already in the sequence whose binary expansion ends with the binary expansion of the binary weight of a(n-1).

Original entry on oeis.org

1, 3, 2, 5, 6, 10, 14, 7, 11, 15, 4, 9, 18, 22, 19, 23, 12, 26, 27, 20, 30, 28, 31, 13, 35, 39, 36, 34, 38, 43, 44, 47, 21, 51, 52, 55, 29, 60, 68, 42, 59, 37, 63, 46, 76, 67, 71, 84, 75, 92, 100, 79, 45, 108, 116, 124, 53, 132, 50, 83, 140, 87, 61, 69, 91, 77
Offset: 1

Views

Author

Michael De Vlieger, Dec 16 2020

Keywords

Comments

Define binary weight wt(n) as A000120(n), the number of 1s in the binary expansion of n. Let w = A000120(a(n-1)) the binary weight of the previous term. In other words, a(n) is the least m not already in the sequence such that m mod 2^k = w, where k = floor(1 + log_2 w).
Likely a permutation of the natural numbers.
The numbers m = 2^k with 0 <= k <= 3 appear at indices {1, 3, 11, 222}. The term 16 has not appeared for n <= 2^14 and may not until n approaches 2^16.
The numbers m = (2^k + 1) appear at indices {2, 4, 12, 223, ...}. The numbers m = 2^k or (2^k + 1) require n approximately equal to 2^m in order to appear in the sequence.
The numbers m = (2^k - 1) with 1 <= k <= 14 appear at indices {1, 2, 8, 10, 23, 43, 130, 278, 447, 758, 1390, 2525, 4719, 9333}, respectively.
The plot exhibits dendritic streams of residues r (mod 2^k). We can identify coordinates (x, y) = (n, a(n)) on the plot where the streams branch.
The branches of the tree in the plot contain m congruent to r (mod 2^k), where r is a term (except the last term) in row (k-1) of A049773.
Given 2^14 terms of this sequence, we see 2 or 3 successive invocations of w, otherwise, w appears just once before a different value succeeds it in the next term.
2^4 appears at index 47201. - Michael S. Branicky, Dec 16 2020
A permutation of the integers since n appears at or before index 2^n - 1, the first number with binary weight n. - Michael S. Branicky, Dec 16 2020

Examples

			a(2) = 3 since the binary weight of 1 is 1, and 3 = 1 (mod 2^1).
a(3) = 2 since wt(3) = 2, and 2 = 2 (mod 2^2).
a(4) = 5 since wt(2) = 1, 5 = 1 (mod 2^1), etc.
		

Crossrefs

Programs

  • Mathematica
    Nest[Append[#, Block[{k = 1, r = DigitCount[#[[-1]], 2, 1], s}, s = IntegerLength[r, 2]; While[Nand[FreeQ[#, k], Mod[k, 2^s] == r], k++]; k]] & @@ {#, Length@ #} &, {1}, 2^7]
  • Python
    def aupto(n):
      alst, used = [1], {1}
      for i in range(2, n+1):
        binprev = bin(alst[-1])[2:]
        binwt = binprev.count("1")
        pow2 = 2**(len(bin(binwt))-2)
        while binwt in used: binwt += pow2
        alst.append(binwt); used.add(binwt)
      return alst    # use alst[n-1] for a(n)
    print(aupto(66)) # Michael S. Branicky, Dec 16 2020

A339024 a(1) = 1, a(n) is the least m not already in the sequence whose binary expansion begins with the binary expansion of the binary weight of a(n-1).

Original entry on oeis.org

1, 2, 3, 4, 5, 8, 6, 9, 10, 11, 7, 12, 16, 13, 14, 15, 17, 18, 19, 24, 20, 21, 25, 26, 27, 32, 22, 28, 29, 33, 23, 34, 35, 30, 36, 37, 31, 40, 38, 48, 39, 64, 41, 49, 50, 51, 65, 42, 52, 53, 66, 43, 67, 54, 68, 44, 55, 45, 69, 56, 57, 70, 58, 71, 72, 46, 73, 59
Offset: 1

Views

Author

Michael De Vlieger, Dec 16 2020

Keywords

Comments

We define binary weight wt(n) = A000120(n) as the number of 1s in n_2, the number n expressed in binary. Let w = wt(a(n-1)) the binary weight of the previous term, where w_2 is w expressed in binary, and let interval I(j) = 2^j <= n <= (2^(j+1)-1).'
Likely a permutation of the natural numbers.
The plot (n, a(n)) is organized into streaky clouds that pertains to a "family" M(i) <= m < M(i+1) whose binary expansion begins with an odd "prefix" m/2^v, where v is the 2-adic valuation of m. There are thus 2^v numbers in this range.
The numbers in this range accommodate the binary weights wt(a(n-1)) = w with 1 <= w <= ceiling(log_2 a(n-1)) such that w_2 appears in part or all of the binary expansion of the prefix m/2^v, and perhaps an additional bit in m after the prefix.
Small values of w, for instance w = 1, may appear in any family, but large w require the entire prefix and potentially more (if even).
The w that cannot be found in a particular family are found in a different family that has M(i+1) as its least member.
The families M(i) belong in turn to classes according to odd prefixes. Thus, for example, we may find w = 1, 2, 4, and 9 in class 9, since "1", "10", "100", and "1001" can be found in numbers m that begin, "1001...".
For w in interval I(j), we have values 1 <= k <= j - 1 distributed binomially.
Permutation of the natural numbers. We can always find w in a number m in family M(i) that pertains to a class C of numbers that in binary start with the binary expansion of an odd number c.
Numbers m that begin with numbers that are formed of left-trimmed bits of c exhaust the numbers in M(i) before moving to M(i+1) in the same class C.
When we have recordsetting odd w, a new class C opens up based on the binary expansion of a larger odd number c.
A permutation of the integers since n appears at or before index 2^n - 1, the first number with binary weight n. - Michael S. Branicky, Dec 16 2020

Examples

			Let wt(n) = A000120(n).
a(2) = 2 since wt(a(1)) = wt(1) = 1, and we find "1" at the beginning of the binary expansion of the yet unused 2 = "10"_2.
a(3) = 3 since wt(2) = 1, we find "1" as first bit of yet unused 3 = "11"_2.
a(4) = 4 since wt(3) = 2 = "10"_2, we find "10" as first bits of yet unused 4 = "100"_2.
a(5) = 5 since wt(4) = 1, and yet unused 5 = "101"_2 starts with 1.
a(6) = 8 since wt(5) = 2 = "10"_2; we see that the yet unused 6 and 7 start with "11"_2, and it isn't until 8 that we have a number that when expressed in binary starts with "10"_2.
a(7) = 6 since wt(8) = 1, we can now apply the yet unused 6 = "110"_2 because it starts with 1, etc.
		

Crossrefs

Programs

  • Mathematica
    Nest[Append[#, Block[{k = 1, r = IntegerDigits[DigitCount[#[[-1]], 2, 1], 2]}, While[Nand[FreeQ[#, k], Take[IntegerDigits[k, 2], Length@ r] == r], k++]; k]] & @@ {#, Length@ #} &, {1}, 2^7]
  • Python
    def aupto(n):
      alst, used = [1], {1}
      for i in range(2, n+1):
        binprev = bin(alst[-1])[2:]
        binwt = binprev.count("1")
        lsbs, extra = 0, 0
        while binwt + extra in used:
          lsbs += 1
          binwt *= 2
          for extra in range(2**lsbs):
            if binwt + extra not in used: break
        alst.append(binwt+extra); used.add(binwt+extra)
      return alst    # use alst[n-1] for a(n)
    print(aupto(68)) # Michael S. Branicky, Dec 16 2020

A340138 a(1)=0, a(n+1) = the least m not already in the sequence such that the decimal digital root r of a(n-1) is found somewhere among the decimal digits of m.

Original entry on oeis.org

0, 10, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 18, 9, 19, 21, 23, 25, 27, 29, 20, 22, 24, 26, 28, 31, 34, 37, 41, 35, 38, 32, 45, 39, 30, 33, 36, 49, 40, 42, 46, 51, 56, 52, 47, 62, 48, 43, 57, 53, 58, 44, 68, 50, 54, 59, 55, 61, 67, 64, 71, 78, 60
Offset: 1

Views

Author

Michael De Vlieger, Jan 21 2021

Keywords

Comments

a(n) = 10^k occurs before n = 10^k for 0 < k <= 5.
Conjecture: permutation of the nonnegative numbers.
A decimal version of A339607, a permutation of the integers having to do with binary weight, but instead using digital root rather than digit sum. The plots of these sequences have similar features.

Crossrefs

Programs

  • Mathematica
    Block[{a = {0, 10}, k, r}, Do[k = 1; r = # + 9 Boole[# == 0] &@ Mod[a[[-1]], 9]; While[Nand[FreeQ[a, k], ! FreeQ[IntegerDigits[k], r]], k++]; AppendTo[a, k], 66]; a]
Showing 1-3 of 3 results.