OFFSET
0,3
COMMENTS
Consecutive identical digits of n are erased. Leading zeros are erased unless the result is 0. If all digits are erased, we write 0 for the result (A321802 is another version, which uses -1 for the empty string).
More than the usual number of terms are shown in order to reach some interesting examples. Agrees with A320486 for n < 101.
LINKS
Paolo Xausa, Table of n, a(n) for n = 0..10000
EXAMPLE
12311 becomes 123, 1123 becomes 23, 11231 becomes 231, and 110232 becomes 232 (as we don't accept leading zeros). Note that 112233 disappears immediately and we get 0.
1110, 11000, 1100011 all become 0.
MATHEMATICA
A321801[n_]:=FromDigits[Flatten[Select[Split[IntegerDigits[n]], Length[#]==1&]]]; Array[A321801, 100, 0] (* Paolo Xausa, Nov 14 2023 *)
PROG
(Python)
from re import split
def A321801(n):
return int('0'+''.join(d if len(d) == 1 else '' for d in split('(0+)|(1+)|(2+)|(3+)|(4+)|(5+)|(6+)|(7+)|(8+)|(9+)', str(n)) if d != '' and d != None))
(PARI) A321801(n)={forstep(i=#n=digits(n), 2, -1, n[i]!=n[i-1]&&next; if(i<3||n[i-2]!=n[i], n=n[^i]; i--); n=n[^i]); fromdigits(n)} \\ M. F. Hasler, Nov 20 2018
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Chai Wah Wu, Nov 19 2018
STATUS
approved