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.

Previous Showing 11-12 of 12 results.

A336963 Left-rotate run-lengths of consecutive equal digits in binary representation of n.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Aug 09 2020

Keywords

Comments

This sequence is a permutation of the nonnegative integers, with inverse A336962.

Examples

			The first terms, in decimal and in binary, are:
  n   a(n)  bin(n)  bin(a(n))
  --  ----  ------  ---------
   0     0       0          0
   1     1       1          1
   2     2      10         10
   3     3      11         11
   4     6     100        110
   5     5     101        101
   6     4     110        100
   7     7     111        111
   8    14    1000       1110
   9    13    1001       1101
  10    10    1010       1010
  11     9    1011       1001
  12    12    1100       1100
  13    11    1101       1011
  14     8    1110       1000
  15    15    1111       1111
		

Crossrefs

Programs

  • PARI
    toruns(n) = { my (r=[]); while (n, my (v=valuation(n+n%2,2)); n\=2^v; r=concat(v,r)); r }
    fromruns(r) = { my (v=0); for (k=1, #r, v=(v+k%2)*2^r[k]-k%2); v }
    a(n) = { my (r=toruns(n)); fromruns(vector(#r, k, r[1+k%#r])) }

Formula

a(n) = n iff n = 0 or n belongs to A140690.

A361477 a(n) is the number of integers whose binary expansions have the same multiset of run-lengths as that of n.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Mar 13 2023

Keywords

Comments

This sequence has similarities with A090706; here we consider multisets of run-lengths, there multisets of digits in binary expansions.

Examples

			For n = 18:
- the binary expansion of 18 is "10010",
- the corresponding multiset of run-lengths is m = (1, 2, 1, 1),
- m has 4 terms: 3 times "1" and once "2",
- so a(18) = 4! / (3! * 1!) = 4.
		

Crossrefs

Programs

  • PARI
    a(n) = { my (r=[]); while (n, my (v=valuation(n+n%2, 2)); n\=2^v; r=concat(v, r)); my (s=Set(r), f=vector(#s)); for (k=1, #r, f[setsearch(s, r[k])]++); (#r)! / prod(k=1, #f, f[k]!) }
    
  • Python
    from math import factorial, prod
    from itertools import groupby
    from collections import Counter
    def A361477(n): return factorial(len(c:=[len(list(g)) for k, g in groupby(bin(n)[2:])]))//prod(map(factorial,Counter(c).values())) # Chai Wah Wu, Mar 16 2023

Formula

a(n) = 1 iff n = 0 or n belongs to A140690.
Previous Showing 11-12 of 12 results.