OFFSET
1,1
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = A078241(n)/n.
PROG
(PARI) isok(n) = my(vd = vecsort(digits(n), , 8)); (vd == [0, 2]) || (vd == [2]);
a(n) = my(k=1); while(!isok(k*n), k++); k; \\ Michel Marcus, Sep 25 2016
(Python)
def next02(n):
s = str(n)
if s > '2'*len(s): return int('2' + '0'*len(s))
for i, c in enumerate(s):
if c == '1': return int(s[:i] + '2' + '0'*(len(s)-i-1))
elif s[i:] > '2'*(len(s)-i): return int(s[:i-1] + '2' + '0'*(len(s)-i))
def a(n):
k = 1
while set(str(k*n)) - set('02') != set(): k = max(k+1, next02(k*n)//n)
return k
print([a(n) for n in range(1, 51)]) # Michael S. Branicky, Feb 01 2021
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Ray Chandler, Jul 12 2004
STATUS
approved