login
A337857
a(n) is the smallest positive integer m with no repeated digits such that A137564(n + m) = n, or a(n) = 0 if no m exists.
2
10, 20, 30, 40, 50, 60, 70, 80, 90, 90, 0, 109, 120, 127, 136, 145, 154, 163, 172, 180, 190, 0, 209, 218, 230, 236, 245, 254, 263, 270, 280, 290, 0, 309, 318, 327, 340, 345, 354, 360, 370, 380, 390, 0, 409, 418, 427, 436, 450, 450, 460, 470, 480, 490, 0, 509, 518, 527, 536, 540
OFFSET
1,1
COMMENTS
Terms computed by Claudio Meller.
We set a(n)=0 when n has repeated digits; for example, a(11) = 0, a(22) = 0, a(100) = 0, a(101) = 0, since compact(c) cannot result in such n. Is n=450 the first other number that has no solution?
LINKS
PROG
(PARI) f(n) = {my(d=digits(n)); fromdigits(vecextract(d, vecsort(vecsort(d, , 9))))}; \\ A137564
isokd(m) = my(d=digits(m)); #d == #Set(d); \\ A010784
a(n) = my(d=digits(n)); if (#Set(d) == #d, my(m=1); while (!isokd(m) || (f(n+m) != n), m++); m); \\ Michel Marcus, Jan 13 2022
(Python)
def has_repeated_digits(n): s = str(n); return len(s) > len(set(s))
def A137564(n):
seen, out, s = set(), "", str(n)
for d in s:
if d not in seen: out += d; seen.add(d)
return int(out)
def a(n):
if n == 0 or has_repeated_digits(n): return 0
m = 1
while has_repeated_digits(m) or A137564(n+m) != n: m += 1
return m
print([a(n) for n in range(1, 61)]) # Michael S. Branicky, Jul 23 2022
CROSSREFS
Sequence in context: A044850 A282150 A338641 * A044895 A370400 A156819
KEYWORD
base,nonn
AUTHOR
Rodolfo Kurchan, Sep 26 2020
STATUS
approved