OFFSET
1,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..1000
V. Shevelev, Binomial Coefficient Predictors, Journal of Integer Sequences, Vol. 14 (2011), Article 11.2.8
MAPLE
a:= proc(n) option remember; local i, l, m, t;
m:= `if`(n=1, 0, a(n-1));
l:= NULL;
for t while m>0 do l:= l, irem(m, 3, 'm') od;
l:= array([l, 0]);
for i while l[i]=2 do od;
if l[i]=0 then l[i]:= 1
else l[i]:= 2;
if i>1 then l[i-1]:= 1 fi
fi;
add(l[i] *3^(i-1), i=1..t)
end:
seq(a(n), n=1..100); # Alois P. Heinz, Apr 02 2011
MATHEMATICA
okQ[n_]:=DigitCount[n, 3, 0]==0&&DigitCount[n, 3, 1]<2; Select[Range[20000], okQ] (* Harvey P. Dale, Apr 16 2011 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Vladimir Shevelev, Apr 02 2011
STATUS
approved