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.

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Keywords

Examples

			From _Antti Karttunen_, Dec 16 2017: (Start)
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.
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.
(End)
		

Crossrefs

Programs

  • Mathematica
    Array[Total[Length /@ #1] - Total[Length /@ Complement[#2, #1]] & @@ {Select[#, OddQ@ Length@ # &], #} &@ Split@ IntegerDigits[#, 9] &, 100] (* Michael De Vlieger, Dec 16 2017 *)
  • 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

Extensions

More terms from Antti Karttunen, Dec 16 2017