cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A320485 Keep just the digits of n that appear exactly once; write -1 if all digits disappear.

This page as a plain text file.
%I A320485 #42 Feb 04 2019 11:21:24
%S A320485 0,1,2,3,4,5,6,7,8,9,10,-1,12,13,14,15,16,17,18,19,20,21,-1,23,24,25,
%T A320485 26,27,28,29,30,31,32,-1,34,35,36,37,38,39,40,41,42,43,-1,45,46,47,48,
%U A320485 49,50,51,52,53,54,-1,56,57,58,59,60,61,62,63,64,65,-1,67,68,69,70,71,72,73,74,75,76,-1,78,79,80,81,82,83,84,85,86,87,-1,89,90,91,92,93,94,95,96,97,98,-1,1,0,102,103,104,105,106,107,108,109,0,-1,2,3,4,5,6,7,8,9,120,2,1,123,124,125,126,127,128,129,130,3
%N A320485 Keep just the digits of n that appear exactly once; write -1 if all digits disappear.
%C A320485 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 -1 for the result.
%C A320485 The map n -> a(n) was invented by _Eric Angelini_ and described in a posting to the Sequence Fans Mailing List on Oct 24 2018.
%C A320485 More than the usual number of terms are shown in order to reach some interesting examples.
%C A320485 a(n) = -1 mostly. - _David A. Corneth_, Oct 24 2018
%D A320485 Eric Angelini, Posting to Sequence Fans Mailing List, Oct 24 2018
%H A320485 Robert Israel, <a href="/A320485/b320485.txt">Table of n, a(n) for n = 0..10000</a>
%H A320485 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)
%F A320485 From _Rémy Sigrist_, Oct 24 2018: (Start)
%F A320485 a(n) = n iff n belong to A010784.
%F A320485 a(n) <= 9876543210 with equality iff n = 9876543210.
%F A320485 (End)
%F A320485 If n > 9876543210, then a(n) < n. If a(n) < n, then a(n) <= 99n/1000. - _Chai Wah Wu_, Oct 24 2018
%e A320485 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 -1.
%e A320485 101 and 110 become 0 while 11000 and 10001 become -1.
%p A320485 f:= proc(n) local F,S;
%p A320485   F:= convert(n,base,10);
%p A320485   S:= select(t -> numboccur(t,F)>1, [$0..9]);
%p A320485   if S = {} then return n fi;
%p A320485   F:= subs(seq(s=NULL,s=S),F);
%p A320485   if F = [] then -1
%p A320485   else add(F[i]*10^(i-1),i=1..nops(F))
%p A320485   fi
%p A320485 end proc:
%p A320485 map(f, [$0..200]); # _Robert Israel_, Oct 24 2018
%t A320485 Array[If[# == {}, -1, FromDigits@ #] &@ Map[If[#[[-1]] > 1, -1, #[[1]] ] /. -1 -> Nothing &, Tally@ IntegerDigits[#]] &, 131] (* _Michael De Vlieger_, Oct 24 2018 *)
%o A320485 (PARI) a(n) = {my(d=digits(n), v = vector(10), res = 0, t = 0); for(i=1, #d, v[d[i]+1]++); for(i=1, #d, if(v[d[i]+1]==1, t = 1; res=10 * res + d[i])); res - !t + !n} \\ _David A. Corneth_, Oct 24 2018
%o A320485 (Python)
%o A320485 def A320485(n):
%o A320485     return (lambda x: int(x) if x != '' else -1)(''.join(d if str(n).count(d) == 1 else '' for d in str(n))) # _Chai Wah Wu_, Nov 19 2018
%Y A320485 See A320486 for another version.
%Y A320485 Cf. A010784, A115853, A321008-A321012.
%K A320485 sign,base,look
%O A320485 0,3
%A A320485 _N. J. A. Sloane_, Oct 24 2018