|
|
A044949
|
|
Number of runs of odd length in the base-9 representation of n.
|
|
2
|
|
|
1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 3, 3, 3, 3
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,9
|
|
LINKS
|
|
|
FORMULA
|
As 731 = 1*(9^3) + 0*(9^2) + 0*(9^1) + 2*(9^0), it is written in base 9 (A007095) as "1002". There is one run of even length, and two runs of length 1 (thus of odd length), thus a(731) = 2. - Antti Karttunen, Dec 22 2017
|
|
MATHEMATICA
|
Array[Count[Map[Length, Split@ IntegerDigits[#, 9]], _?OddQ] &, 105] (* Michael De Vlieger, Dec 22 2017 *)
|
|
PROG
|
(PARI) A044949(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 += (rl%2); prev_d = d; rl = 1)); (s + (rl%2)); }; \\ Antti Karttunen, Dec 22 2017
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|