Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #43 Oct 29 2022 07:06:31
%S 0,1,3,0,4,9,15,22,30,39,49,60,72,85,99,114,4,21,2,21,1,0,22,0,24,4,
%T 30,57,85,114,144,44,76,109,143,14,50,87,7,46,6,47,7,50,94,9,55,102,
%U 150,199,249,300,352,2,56,6,0,57,7,66,0,61,1,64,0,65,5
%N a(1)=0; if a(n-1) shares any digits with n-1, then a(n) = a(n-1) with all copies of digits from n-1 removed. Otherwise, a(n) = a(n-1) + (n-1).
%C If n-1 contains all digits of a(n-1), then a(n) = 0.
%H Gavin Lupo, <a href="/A357884/b357884.txt">Table of n, a(n) for n = 1..10000</a>
%H Thomas Scheuerle, <a href="/A357884/a357884.png">Scatter plot log(1+a(1..100000))</a>
%e n a(n)
%e -- ----
%e 14 85
%e 15 85 + 14 = 99
%e 16 99 + 15 = 114
%e 17 1's removed = 4
%t 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 *)
%o (MATLAB)
%o function a = A357884( max_n )
%o a = 0;
%o for n = 2:max_n
%o sa = num2str(a(n-1));
%o s = intersect(sa,num2str(n-2));
%o if isempty(s)
%o a(n) = a(n-1)+(n-2);
%o else
%o sd = ['0' regexprep(sa,['[' s ']'],'')];
%o a(n) = str2double(sd);
%o end
%o end
%o a = a(2:end);
%o end % _Thomas Scheuerle_, Oct 18 2022
%o (Python)
%o from itertools import count, islice
%o def A357884_gen(): # generator of terms
%o a, s = 0, '0'
%o for n in count(1):
%o yield a
%o if len(t:=set(s)&set(str(n))) > 0:
%o a = int(s.translate(s.maketrans('','',''.join(t))) or 0)
%o else:
%o a += n
%o s = str(a)
%o A357884_list = list(islice(A357884_gen(),30)) # _Chai Wah Wu_, Oct 27 2022
%Y Cf. A045541.
%K nonn,base,easy,look
%O 1,3
%A _Gavin Lupo_, Oct 18 2022