OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
h:= proc(n)
option remember;
local t, x;
t:= n mod 3;
if t = 2 then -1
else
x:= procname((n-t)/3);
if x = -1 then -1
else 10*x + t
fi
fi
end proc:
h(0):= 0:
h(1):= 1:
A004283:= proc(n) local k, r;
for k from 1 do
r:= h(k*n);
if r <> -1 then return r fi
od
end proc:
seq(A004283(n), n=1..100); # Robert Israel, Dec 26 2015
MATHEMATICA
lpm3[n_]:=Module[{k=1}, While[DigitCount[k*n, 3, 2]>0, k++]; FromDigits[ IntegerDigits[ k*n, 3]]]; Array[lpm3, 40] (* Harvey P. Dale, Mar 02 2020 *)
PROG
(PARI) a(n) = {k=1; while (vecmax(digits(k*n, 3)) != 1, k++); subst(Pol(digits(k*n, 3)), x, 10); } \\ Michel Marcus, Dec 27 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
a(34) corrected by Sean A. Irvine, Dec 26 2015
STATUS
approved