login
A181061
a(n) is the smallest positive number such that the decimal digits of n*a(n) are all 0, 1 or 2.
11
1, 1, 1, 4, 3, 2, 2, 3, 14, 1358, 1, 1, 1, 17, 8, 8, 7, 6, 679, 58, 1, 1, 1, 44, 5, 4, 47, 786, 4, 38, 4, 71, 35, 34, 3, 6, 617, 3, 29, 259, 3, 271, 5, 47, 5, 2716, 22, 26, 25, 229, 2, 2, 231, 4, 393, 2, 2, 193, 19, 19, 2, 2, 181, 194, 33, 34, 17, 3, 15, 29, 3, 31, 1696, 14, 3, 16, 145
OFFSET
0,4
COMMENTS
Records occur for n: 1, 3, 8, 9, 45, 89, 99, 495, 998, ..., . [Robert G. Wilson v, Oct 04 2010]
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 0..100000 (first 20000 terms and some terms up to 100000 from Victor Maslov)
FORMULA
If a(n)=k, then a(10n)=k. [Robert G. Wilson v, Oct 04 2010]
EXAMPLE
a(9)=1358 because 9*1358=12222 is the smallest multiple of 9 whose decimal digits are all 0, 1 or 2.
MATHEMATICA
f[n_] := Block[{id = {0, 1, 2}, k = 1}, While[ Union@ Join[id, IntegerDigits[k*n]] != id, k++ ]; k]; Array[f, 76] (* Robert G. Wilson v, Oct 04 2010 *)
PROG
(PARI) a(n)=my(k=n, t); while(1, t=vecsort(eval(Vec(Str(k))), , 8); if(t[#t]<3, return(k/n), k+=n)) \\ Charles R Greathouse IV, Sep 05 2011
(PARI) anydiggt2(n)=if(n<2, 0, while(n>0, if(n%10>2, return(1)); n\=10); 0)
a(n)={local(prd, ms=[], rems=[], msn, remsn, pow=10, maxm);
if(n<=0, return(0));
while(n%10==0, n\=10);
maxm=if(n%10==5, 5, if(n%2==1, 3, 4));
for(d=1, 9, if(!anydiggt2(prd=d*n), return(d));
if(prd%10<=2, ms=concat(ms, [d]); rems=concat(rems, [prd\10])));
while(1,
msn=listcreate(maxm*#ms); remsn=listcreate(maxm*#ms);
for(d=0, 9,
for(k=1, #ms,
if(!anydiggt2(prd=d*n+rems[k]), return(d*pow+ms[k]));
if(prd%10<=2, listput(msn, d*pow+ms[k]); listput(remsn, prd\10))));
ms=Vec(msn); rems=Vec(remsn); pow*=10; print1("."))}
CROSSREFS
n*a(n) yields sequence A181060.
Sequence in context: A155462 A109496 A138851 * A329934 A269611 A090342
KEYWORD
base,nonn
AUTHOR
Herman Beeksma, Oct 01 2010
STATUS
approved