login
Least positive multiple of n that when written in base 10 uses only 0's, 1's, 2's and 3's.
2

%I #39 May 06 2022 13:13:51

%S 1,2,3,12,10,12,21,32,333,10,11,12,13,112,30,32,102,1332,133,20,21,22,

%T 23,120,100,130,1323,112,203,30,31,32,33,102,210,1332,111,1102,312,

%U 120,123,210,301,132,3330,230,1222,1200,1323,100,102,312,212,2322,110

%N Least positive multiple of n that when written in base 10 uses only 0's, 1's, 2's and 3's.

%C a(n) = n iff n is in A007090; there is no isolated fixed point because fixed points are always in patterns of 4 consecutive terms, and the first few patterns are (0,1,2,3), (10,11,12,13), (20,21,22,23), (30,31,32,33), (100,101,102,103) ...

%H Rémy Sigrist, <a href="/A334914/b334914.txt">Table of n, a(n) for n = 1..10000</a>

%e a(18) = 1332 because 1332 is the smallest multiple of 18 whose decimal digits are all 0, 1, 2 or 3.

%p f:= proc(n) local k;

%p for k from 1 do if convert(convert(k*n,base,10),set) subset {0,1,2,3} then return k*n fi od

%p end proc:

%p map(f, [$1..100]); # _Robert Israel_, May 18 2020

%t Table[SelectFirst[Rest @ Flatten [FromDigits /@ Tuples[Range[0, 3], 4]], Divisible[#, n] &], {n, 1, 55}] (* _Amiram Eldar_, May 16 2020 *)

%o (PARI) a(n) = my(k=1); while(vecmax(digits(k*n))>3, k++); k*n \\ _Michel Marcus_, May 17 2020

%Y Cf. A004290 (similar, with digits 0 and 1), A181060 (similar, with digits 0, 1 and 2).

%K nonn,base

%O 1,2

%A _Bernard Schott_, May 16 2020