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.
%I A297772 #10 Jul 15 2024 23:36:26 %S A297772 1,1,1,2,1,2,2,2,2,1,2,2,2,2,1,2,2,3,3,2,1,2,2,3,2,2,3,3,2,3,2,2,3,2, %T A297772 3,3,2,2,3,2,2,1,2,3,3,2,2,2,3,3,2,3,2,3,2,3,3,2,2,2,2,2,1,2,2,3,3,2, %U A297772 3,3,3,3,3,3,4,3,3,4,3,2,3,3,3,2,1,2 %N A297772 Number of distinct runs in base-4 digits of n. %C A297772 Every positive integers occurs infinitely many times. See A297770 for a guide to related sequences. %H A297772 Clark Kimberling, <a href="/A297772/b297772.txt">Table of n, a(n) for n = 1..10000</a> %e A297772 123456 in base-4: 1,3,2,0,2,1,0,0,0; seven runs, of which 5 are distinct, so that a(123456) = 5. %t A297772 b = 4; s[n_] := Length[Union[Split[IntegerDigits[n, b]]]] %t A297772 Table[s[n], {n, 1, 200}] %o A297772 (Python) %o A297772 from itertools import groupby %o A297772 from sympy.ntheory import digits %o A297772 def A297772(n): return len(set(map(lambda x:tuple(x[1]),groupby(sympydigits(n,4)[1:])))) # _Chai Wah Wu_, Jul 13 2024 %o A297772 (PARI) apply( {A297772(n)=my(r=Vec(0, 4), c); while(n, my(d=bitand(n,3), L=valuation(n+if(d==3, 1, d==2, n\2+1, d, n<<1+1), if(d==2, 2, 4))); d==2 && L\/=2; !bittest(r[1+d], L) && c++ && r[1+d] += 1<<L; n>>=2*L); c}, [0..99]) \\ _M. F. Hasler_, Jul 15 2024 %Y A297772 Cf. A043556 (number of runs, not necessarily distinct), A297770 (distinct runs in base 2). %K A297772 nonn,base,easy %O A297772 1,4 %A A297772 _Clark Kimberling_, Jan 27 2018