OFFSET
1,3
COMMENTS
If n-1 contains all digits of a(n-1), then a(n) = 0.
LINKS
Gavin Lupo, Table of n, a(n) for n = 1..10000
Thomas Scheuerle, Scatter plot log(1+a(1..100000))
EXAMPLE
n a(n)
-- ----
14 85
15 85 + 14 = 99
16 99 + 15 = 114
17 1's removed = 4
MATHEMATICA
a[0] = 0; a[n_] := a[n] = Module[{da = IntegerDigits[a[n - 1]], dn = IntegerDigits[n - 1]}, If[Intersection[da, dn] == {}, a[n - 1] + n - 1, FromDigits[Select[da, ! MemberQ[dn, #] &]]]]; Array[a, 100, 0] (* Amiram Eldar, Oct 21 2022 *)
PROG
(MATLAB)
function a = A357884( max_n )
a = 0;
for n = 2:max_n
sa = num2str(a(n-1));
s = intersect(sa, num2str(n-2));
if isempty(s)
a(n) = a(n-1)+(n-2);
else
sd = ['0' regexprep(sa, ['[' s ']'], '')];
a(n) = str2double(sd);
end
end
a = a(2:end);
end % Thomas Scheuerle, Oct 18 2022
(Python)
from itertools import count, islice
def A357884_gen(): # generator of terms
a, s = 0, '0'
for n in count(1):
yield a
if len(t:=set(s)&set(str(n))) > 0:
a = int(s.translate(s.maketrans('', '', ''.join(t))) or 0)
else:
a += n
s = str(a)
CROSSREFS
KEYWORD
AUTHOR
Gavin Lupo, Oct 18 2022
STATUS
approved