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 A044940 #19 Dec 16 2017 22:41:10 %S A044940 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0, %T A044940 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, %U A044940 0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 %N A044940 Number of runs of even length in base-9 representation of n. %H A044940 Antti Karttunen, <a href="/A044940/b044940.txt">Table of n, a(n) for n = 1..100000</a> %e A044940 From _Antti Karttunen_, Dec 15 2017: (Start) %e A044940 For n = 810 = 729 + 81 = 9^3 + 9^2 thus in base 9 written as "1100", we count two runs, both of length 2, thus both even, so a(810) = 2. %e A044940 For n = 32805 = 5*(9^4), thus in base 9 "50000", there is one run of even length, so a(32805) = 1. %e A044940 For n = 65630 = 1*(9^5) + 1*(9^4) + 0*(9^3) + 0*(9^2) + 2*(9^1) + 2*(9^0) thus written as "110022" in base 9, there are three runs, all of length 2, thus all even, so a(65630) = 3. %e A044940 (End) %p A044940 f:= proc(n) local i,j,t,Q,d; %p A044940 Q:= convert(n,base,9); %p A044940 d:= nops(Q); %p A044940 i:= 1: t:= 0: %p A044940 while i < d do %p A044940 for j from i+1 to d while Q[j] = Q[i] do od: %p A044940 if (j-i)::even then t:= t+1 fi; %p A044940 i:= j; %p A044940 od; %p A044940 t %p A044940 end proc: %p A044940 map(f, [$1..100]); # _Robert Israel_, Dec 15 2017 %t A044940 a[n_] := Count[Length /@ Split[IntegerDigits[n, 9]], _?EvenQ]; %t A044940 Array[a, 120] (* _Jean-François Alcover_, Dec 16 2017 *) %o A044940 (PARI) A044940(n) = { my(rl=1, d, prev_d = -1, s=0); while(n>0, d = (n%9); n = ((n-d)/9); if(d==prev_d, rl++, s += (1-(rl%2)); prev_d = d; rl = 1)); (s + (1-(rl%2))); }; \\ _Antti Karttunen_, Dec 15 2017 %Y A044940 Cf. A043283, A044931. %K A044940 nonn,base %O A044940 1,810 %A A044940 _Clark Kimberling_ %E A044940 More terms and secondary offset added by _Antti Karttunen_, Dec 15 2017