login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A320486 Keep just the digits of n that appear exactly once; write 0 if all digits disappear. 20

%I #48 Jun 23 2023 20:13:07

%S 0,1,2,3,4,5,6,7,8,9,10,0,12,13,14,15,16,17,18,19,20,21,0,23,24,25,26,

%T 27,28,29,30,31,32,0,34,35,36,37,38,39,40,41,42,43,0,45,46,47,48,49,

%U 50,51,52,53,54,0,56,57,58,59,60,61,62,63,64,65,0,67,68,69,70,71,72,73,74,75,76,0,78,79,80,81,82,83,84,85,86,87,0,89,90,91,92,93,94,95,96,97,98,0,1,0,102,103,104,105,106,107,108,109,0,0,2,3,4,5,6,7,8,9,120,2,1,123,124,125,126,127,128,129,130,3

%N Keep just the digits of n that appear exactly once; write 0 if all digits disappear.

%C Digits that appear more than once in n are erased. Leading zeros are erased unless the result is 0. If all digits are erased, we write 0 for the result (A320485 is another version, which uses -1 for the empty string).

%C More than the usual number of terms are shown in order to reach some interesting examples.

%C a(n) = 0 mostly. - _David A. Corneth_, Oct 24 2018

%C The number of d-digit numbers n for which a(n) > 0 is at most d*9^d, so in this sense most a(n) are 0. - _Robert Israel_, Oct 24 2018

%C The set of numbers with the property that their digits appear at least twice is of asymptotic density 1 (and the set of numbers that have a digit that occurs only once is of density 0), so in that sense it is rather exceptional for large n to have a(n) > 0. - _M. F. Hasler_, Oct 24 2018

%D Eric Angelini, Posting to Sequence Fans Mailing List, Oct 24 2018

%H Robert Israel, <a href="/A320486/b320486.txt">Table of n, a(n) for n = 0..10000</a>

%H N. J. A. Sloane, Coordination Sequences, Planing Numbers, and Other Recent Sequences (II), Experimental Mathematics Seminar, Rutgers University, Jan 31 2019, <a href="https://vimeo.com/314786942">Part I</a>, <a href="https://vimeo.com/314790822">Part 2</a>, <a href="https://oeis.org/A320487/a320487.pdf">Slides.</a> (Mentions this sequence)

%e 1231 becomes 23, 1123 becomes 23, 11231 becomes 23, and 11023 becomes 23 (as we don't accept leading zeros). Note that 112323 disappears immediately and we get 0.

%e 101, 110, 11000, 10001 all become 0.

%p f:= proc(n) local F,S;

%p F:= convert(n,base,10);

%p S:= select(t -> numboccur(t,F)>1, [$0..9]);

%p if S = {} then return n fi;

%p F:= subs(seq(s=NULL,s=S),F);

%p add(F[i]*10^(i-1),i=1..nops(F))

%p end proc:

%p map(f, [$0..200]); # _Robert Israel_, Oct 24 2018

%t Table[If[(c=Select[b=IntegerDigits[n],Count[b,#]==1&])=={},0,FromDigits@c],{n,0,131}] (* _Giorgos Kalogeropoulos_, May 09 2021 *)

%t d1[n_]:=Module[{idn=IntegerDigits[n]},FromDigits[If[DigitCount[n,10,#]>1,Nothing,#]&/@ idn]]; Array[d1,150,0] (* _Harvey P. Dale_, Jun 23 2023 *)

%o (PARI) a(n) = {my(d=digits(n), v = vector(10), res = 0); for(i=1,#d, v[d[i]+1]++); for(i=1,#d,if(v[d[i]+1]==1, res=10*res+d[i]));res}

%o (PARI) A320486(n,D=digits(n))=fromdigits(select(d->#select(t->t==d,D)<2,D)) \\ _M. F. Hasler_, Oct 24 2018

%o (Python)

%o def A320486(n):

%o return int('0'+''.join(d if str(n).count(d) == 1 else '' for d in str(n))) # _Chai Wah Wu_, Nov 19 2018

%Y See A320485 for a different version.

%Y Cf. A321008-A321012, A321021.

%K nonn,base,look

%O 0,3

%A _N. J. A. Sloane_, Oct 24 2018

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 16:03 EDT 2024. Contains 371794 sequences. (Running on oeis4.)