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.

A165933 Least integer, k, whose value is n in A165413.

Original entry on oeis.org

1, 4, 35, 536, 16775, 1060976, 135007759, 34460631520, 17617985239071, 18027600169142208, 36907002795598798911, 151143401509104346210176, 1238053384151947477501575295, 20283338091738780737237428502272, 664629209970464486086782992577855743
Offset: 1

Views

Author

Robert G. Wilson v, Sep 30 2009

Keywords

Comments

An alternative name: The smallest number whose binary expansion has exactly n distinct run-lengths. - Gus Wiseman, Feb 21 2022
Term a(n) has one 1, followed by n 0's, then two 1's, (n-1) 0's, ..., up to n runs; see Python program. - Michael S. Branicky, Feb 22 2022

Examples

			a(1) in binary is 1, a(2) in binary is 100, a(3) in binary is 100011, a(4) in binary is 1000011000, etc.
From _Gus Wiseman_, Feb 21 2022: (Start)
The terms and their binary expansions begin:
  n              a(n)
  1:               1 =                                             1
  2:               4 =                                           100
  3:              35 =                                        100011
  4:             536 =                                    1000011000
  5:           16775 =                               100000110000111
  6:         1060976 =                         100000011000001110000
  7:       135007759 =                  1000000011000000111000001111
  8:     34460631520 =          100000000110000000111000000111100000
  9:  17617985239071 = 100000000011000000001110000000111100000011111
(End)
		

Crossrefs

A subset of A044813 (distinct run-lengths) and of A175413 (distinct runs).
These are the positions of first appearances in A165413.
The version for runs instead of run-lengths is A350952, firsts of A297770.
A000120 counts binary weight.
A005811 counts runs in binary expansion.
A242882 counts compositions with distinct multiplicities.
A318928 gives runs-resistance of binary expansion.
A351014 counts distinct runs in standard compositions.
Counting words with all distinct run-lengths:
- A032020 = binary expansions, for runs A351018.
- A329739 = compositions, for runs A351013.
- A351017 = binary words, for runs A351016.
- A351292 = patterns, for runs A351200.

Programs

  • Mathematica
    g[n_] := Table[ {Table[1, {i}], Table[0, {n - i + 1}]}, {i, Floor[(n + If[ OddQ@n, 1, 0])/2]}]; f[n_] := FromDigits[ If[ OddQ@n, Flatten@ Most@ Flatten[ g@n, 1], Flatten@ g@n], 2]; Array[f, 14]
    s=Table[Length[Union[Length/@Split[IntegerDigits[n,2]]]],{n,0,1000}]; Table[Position[s,k][[1,1]]-1,{k,Union[s]}] (* Gus Wiseman, Feb 21 2022 *)
  • Python
    def a(n): # returns term by construction
        if n == 1: return 1
        q, r = divmod(n+1, 2)
        s = "".join("1"*i + "0"*(n+1-i) for i in range(1, q+1))
        if r == 0: s = s.rstrip("0")
        return int(s, 2)
    print([a(n) for n in range(1, 16)]) # Michael S. Branicky, Feb 22 2022

Extensions

a(15) and beyond from Michael S. Branicky, Feb 22 2022