A181061 a(n) is the smallest positive number such that the decimal digits of n*a(n) are all 0, 1 or 2.
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
Examples
a(9)=1358 because 9*1358=12222 is the smallest multiple of 9 whose decimal digits are all 0, 1 or 2.
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)
- Victor Maslov, Log-log plot for n = 0..20000
- Project Euler, Problem 303: Multiples with small digits
Crossrefs
n*a(n) yields sequence A181060.
Programs
-
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 *)
-
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("."))}
Formula
If a(n)=k, then a(10n)=k. [Robert G. Wilson v, Oct 04 2010]
Comments