|
|
A297770
|
|
Number of distinct runs in base-2 digits of n.
|
|
56
|
|
|
1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 3, 2, 3, 2, 1, 2, 2, 3, 3, 3, 2, 3, 3, 2, 3, 3, 2, 2, 3, 2, 1, 2, 2, 3, 3, 2, 3, 4, 3, 3, 3, 2, 3, 4, 3, 3, 3, 2, 3, 4, 2, 4, 3, 2, 3, 2, 3, 3, 3, 2, 3, 2, 1, 2, 2, 3, 3, 3, 3, 4, 3, 3, 2, 3, 4, 3, 4, 4, 3, 3, 3, 3, 4, 3, 2, 3
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
Every positive integers occurs infinitely many times.
***
Guide to related sequences:
Base b # runs # distinct runs
|
|
LINKS
|
|
|
EXAMPLE
|
27 in base-2: 1,1,0,1,1; three runs, of which 2 are distinct: 0 and 11, so that a(27) = 2.
|
|
MATHEMATICA
|
b = 2; s[n_] := Length[Union[Split[IntegerDigits[n, b]]]]
Table[s[n], {n, 1, 200}]
|
|
PROG
|
(Python)
from itertools import groupby
def A297770(n): return len(set(map(lambda x:tuple(x[1]), groupby(bin(n)[2:])))) # Chai Wah Wu, Jul 13 2024
(PARI) apply( {A297770(n)=my(r=[0, 0], c); while(n, my(d=bitand(n, 1), L=valuation(n+d, 2)); !bittest(r[1+d], L) && c++ && r[1+d] += 1<<L; n>>=L); c}, [0..99]) \\ M. F. Hasler, Jul 13 2024
|
|
CROSSREFS
|
Cf. A005811 (number of runs, not necessarily distinct).
|
|
KEYWORD
|
nonn,base,easy,changed
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|