login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A044940 Number of runs of even length in base-9 representation of n. 5
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, 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, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,810
LINKS
EXAMPLE
From Antti Karttunen, Dec 15 2017: (Start)
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.
For n = 32805 = 5*(9^4), thus in base 9 "50000", there is one run of even length, so a(32805) = 1.
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.
(End)
MAPLE
f:= proc(n) local i, j, t, Q, d;
Q:= convert(n, base, 9);
d:= nops(Q);
i:= 1: t:= 0:
while i < d do
for j from i+1 to d while Q[j] = Q[i] do od:
if (j-i)::even then t:= t+1 fi;
i:= j;
od;
t
end proc:
map(f, [$1..100]); # Robert Israel, Dec 15 2017
MATHEMATICA
a[n_] := Count[Length /@ Split[IntegerDigits[n, 9]], _?EvenQ];
Array[a, 120] (* Jean-François Alcover, Dec 16 2017 *)
PROG
(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
CROSSREFS
Sequence in context: A369660 A353495 A302047 * A284261 A037825 A278701
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
More terms and secondary offset added by Antti Karttunen, Dec 15 2017
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 14:49 EDT 2024. Contains 371914 sequences. (Running on oeis4.)