This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A096681 #18 Feb 01 2021 16:46:11 %S A096681 2,1,74,5,4,37,286,25,24691358,2,2,185,154,143,148,125,1306,12345679, %T A096681 1158,1,962,1,9574,925,8,77,81563786,715,75938,74,7162,625,6734,653, %U A096681 572,61728395,6,579,518,5,542,481,51214,5,49382716,4787,426,4625,44898,4 %N A096681 Least k such that decimal representation of k*n contains only digits 0 and 2. %H A096681 Robert G. Wilson v, <a href="/A096681/b096681.txt">Table of n, a(n) for n = 1..10000</a> %F A096681 a(n) = A078241(n)/n. %o A096681 (PARI) isok(n) = my(vd = vecsort(digits(n),,8)); (vd == [0,2]) || (vd == [2]); %o A096681 a(n) = my(k=1); while(!isok(k*n), k++); k; \\ _Michel Marcus_, Sep 25 2016 %o A096681 (Python) %o A096681 def next02(n): %o A096681 s = str(n) %o A096681 if s > '2'*len(s): return int('2' + '0'*len(s)) %o A096681 for i, c in enumerate(s): %o A096681 if c == '1': return int(s[:i] + '2' + '0'*(len(s)-i-1)) %o A096681 elif s[i:] > '2'*(len(s)-i): return int(s[:i-1] + '2' + '0'*(len(s)-i)) %o A096681 def a(n): %o A096681 k = 1 %o A096681 while set(str(k*n)) - set('02') != set(): k = max(k+1, next02(k*n)//n) %o A096681 return k %o A096681 print([a(n) for n in range(1, 51)]) # _Michael S. Branicky_, Feb 01 2021 %Y A096681 Cf. A004290, A078241-A078248, A079339, A096682, A096683, A096684, A096685, A096686, A096687, A096688. %K A096681 base,nonn %O A096681 1,1 %A A096681 _Ray Chandler_, Jul 12 2004