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.

A044931 a(n) = so-se, where so(se)=sum of odd(even) base 9 run lengths of n.

This page as a plain text file.
%I A044931 #17 Dec 16 2017 22:40:38
%S A044931 1,1,1,1,1,1,1,1,2,-2,2,2,2,2,2,2,2,2,2,-2,2,2,2,2,2,2,2,2,2,-2,2,2,2,
%T A044931 2,2,2,2,2,2,-2,2,2,2,2,2,2,2,2,2,-2,2,2,2,2,2,2,2,2,2,-2,2,2,2,2,2,2,
%U A044931 2,2,2,-2,2,2,2,2,2,2,2,2,2,-2,-1,3,3,3,3,3,3,3,3,-1,3,-1,-1,-1,-1,-1,-1,-1,3,3
%N A044931 a(n) = so-se, where so(se)=sum of odd(even) base 9 run lengths of n.
%H A044931 Antti Karttunen, <a href="/A044931/b044931.txt">Table of n, a(n) for n = 1..66430</a>
%e A044931 From _Antti Karttunen_, Dec 16 2017: (Start)
%e A044931 For n = 82 = 1*(9^2) + 0*(9^1) + 1*(9^0), thus written as "101" in base 9, there are three odd runs (each of length 1) and no even runs, so a(82) = 3*1 = 3.
%e A044931 For n = 7383, "11113" in base 9, there is an even run of length 4 and an odd run of length 1, thus a(7383) = 1-4 = -3.
%e A044931 (End)
%t A044931 Array[Total[Length /@ #1] - Total[Length /@ Complement[#2, #1]] & @@ {Select[#, OddQ@ Length@ # &], #} &@ Split@ IntegerDigits[#, 9] &, 100] (* _Michael De Vlieger_, Dec 16 2017 *)
%o A044931 (PARI) A044931(n) = { my(rl=0, d, prev_d = -1, s=0); while(n>0, d = (n%9); n = ((n-d)/9); if(d==prev_d, rl++, s += ((-1)^rl)*rl; prev_d = d; rl = 1)); -(s + ((-1)^rl)*rl); }; \\ _Antti Karttunen_, Dec 16 2017
%Y A044931 Cf. A043283, A044940.
%K A044931 sign,base
%O A044931 1,9
%A A044931 _Clark Kimberling_
%E A044931 More terms from _Antti Karttunen_, Dec 16 2017