OFFSET
1,3
COMMENTS
EXAMPLE
16400 is 10000100 in base 4 and 1011100 in base 5.
MAPLE
split:= proc(ab, B)
local a, b, La, Lb, k, j, a1, a2, b1, b2, x;
global Res, count;
a:= ab[1]; b:= ab[2];
if b-a <= 1000 then
for x from a to b-1 do
if max(convert(x, base, 4)) <= 1 and max(convert(x, base, 5)) <= 1 then
count:= count+1; Res[count]:= x
fi
od;
return ({});
fi;
La:= convert(a, base, B);
Lb:= convert(b, base, B);
if nops(Lb) > nops(La) then La:= [op(La), 0$(nops(Lb)-nops(La))] fi;
k:= ListTools:-SelectLast(`>`, Lb-La, 0, output=indices);
if La[k] = 0 then
a1:= a;
b1:= 2 + add(B^i, i=1..k-2) + add(La[i]*B^(i-1), i=k+1..nops(La));
a2:= B^(k-1) + add(La[i]*B^(i-1), i=k+1..nops(La));
b2:= min(b, b1 + B^(k-1));
return(select(t -> (t[1]<t[2]), {[a1, b1], [a2, b2]}));
elif La[k] = 1 then
a1:= a;
b1:= 2 + add(B^i, i=1..k-2) + add(La[i]*B^(i-1), i=k..nops(La));
return(select(t -> t[1]<t[2], [[a1, b1]]))
else return ( {})
fi;
end proc:
count:= 0: Res:= 'Res':
Cands:= {[0, 10^400]}:
while nops(Cands) > 0 do
Cands:= map(op@split, Cands, 5);
Cands:= map(op@split, Cands, 4);
od:
sort(convert(Res, list));
MATHEMATICA
Select[Range[0, 83000], Max[Join[IntegerDigits[#, 4], IntegerDigits[#, 5]]]<2&] (* Harvey P. Dale, Sep 04 2018 *)
PROG
(PARI) isok(n) = (n==0) || ((vecmax(digits(n, 4))<=1) && (vecmax(digits(n, 5))<=1)); \\ Michel Marcus, Oct 24 2015
CROSSREFS
KEYWORD
nonn,fini,full
AUTHOR
Robert Israel, Oct 23 2015
STATUS
approved