login
A037818
Number of i such that d(i)>d(i-1), where Sum{d(i)*3^i: i=0,1,....,m} is base 3 representation of n.
2
0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 2, 1, 1, 1, 1, 0, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 2, 1, 1, 1, 1, 0, 1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 0, 1, 1, 1, 2, 1, 1, 2, 2, 1, 2
OFFSET
1,21
COMMENTS
From Jeffrey Shallit, May 15 2016: (Start)
A "3-regular" sequence that satisfies the recurrences
a(3n+2) = a(n)
a(9n) = a(9n+1) = a(3n)
a(9n+4) = a(3n+1)
a(9n+6) = a(9n+7) = a(n) + 1
a(27n+3) = a(3n) + 1
a(27n+12) = a(9n+3)
a(27n+21) = a(n) + 2
(End)
MAPLE
A037818 := proc(n)
a := 0 ;
dgs := convert(n, base, 3);
for i from 2 to nops(dgs) do
if op(i, dgs)>op(i-1, dgs) then
a := a+1 ;
end if;
end do:
a ;
end proc: # R. J. Mathar, Oct 15 2015
MATHEMATICA
a[n_] := Count[Differences@ IntegerDigits[n, 3], x_ /; x < 0]; Array[a, 90] (* Giovanni Resta, May 15 2016 *)
CROSSREFS
Sequence in context: A178535 A025449 A047988 * A087116 A033264 A258045
KEYWORD
nonn,base
EXTENSIONS
Sign in name corrected by R. J. Mathar, Oct 15 2015
STATUS
approved