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.

Showing 1-3 of 3 results.

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

Original entry on oeis.org

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, 27, 28, 29, 30, 31, 32, 0, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 0, 45, 46, 47, 48, 49, 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
Offset: 0

Views

Author

N. J. A. Sloane, Oct 24 2018

Keywords

Comments

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).
More than the usual number of terms are shown in order to reach some interesting examples.
a(n) = 0 mostly. - David A. Corneth, Oct 24 2018
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
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

Examples

			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.
101, 110, 11000, 10001 all become 0.
		

References

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

Crossrefs

See A320485 for a different version.

Programs

  • Maple
    f:= proc(n) local F,S;
      F:= convert(n,base,10);
      S:= select(t -> numboccur(t,F)>1, [$0..9]);
      if S = {} then return n fi;
      F:= subs(seq(s=NULL,s=S),F);
      add(F[i]*10^(i-1),i=1..nops(F))
    end proc:
    map(f, [$0..200]); # Robert Israel, Oct 24 2018
  • Mathematica
    Table[If[(c=Select[b=IntegerDigits[n],Count[b,#]==1&])=={},0,FromDigits@c],{n,0,131}] (* Giorgos Kalogeropoulos, May 09 2021 *)
    d1[n_]:=Module[{idn=IntegerDigits[n]},FromDigits[If[DigitCount[n,10,#]>1,Nothing,#]&/@ idn]]; Array[d1,150,0] (* Harvey P. Dale, Jun 23 2023 *)
  • 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}
    
  • PARI
    A320486(n,D=digits(n))=fromdigits(select(d->#select(t->t==d,D)<2,D)) \\ M. F. Hasler, Oct 24 2018
    
  • Python
    def A320486(n):
        return int('0'+''.join(d if str(n).count(d) == 1 else '' for d in str(n))) # Chai Wah Wu, Nov 19 2018

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

Original entry on oeis.org

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, 26, 27, 28, 29, 30, 31, 32, -1, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, -1, 45, 46, 47, 48, 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
Offset: 0

Views

Author

N. J. A. Sloane, Oct 24 2018

Keywords

Comments

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.
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.
More than the usual number of terms are shown in order to reach some interesting examples.
a(n) = -1 mostly. - David A. Corneth, Oct 24 2018

Examples

			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.
101 and 110 become 0 while 11000 and 10001 become -1.
		

References

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

Crossrefs

See A320486 for another version.

Programs

  • Maple
    f:= proc(n) local F,S;
      F:= convert(n,base,10);
      S:= select(t -> numboccur(t,F)>1, [$0..9]);
      if S = {} then return n fi;
      F:= subs(seq(s=NULL,s=S),F);
      if F = [] then -1
      else add(F[i]*10^(i-1),i=1..nops(F))
      fi
    end proc:
    map(f, [$0..200]); # Robert Israel, Oct 24 2018
  • Mathematica
    Array[If[# == {}, -1, FromDigits@ #] &@ Map[If[#[[-1]] > 1, -1, #[[1]] ] /. -1 -> Nothing &, Tally@ IntegerDigits[#]] &, 131] (* Michael De Vlieger, Oct 24 2018 *)
  • 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
    
  • Python
    def A320485(n):
        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

Formula

From Rémy Sigrist, Oct 24 2018: (Start)
a(n) = n iff n belong to A010784.
a(n) <= 9876543210 with equality iff n = 9876543210.
(End)
If n > 9876543210, then a(n) < n. If a(n) < n, then a(n) <= 99n/1000. - Chai Wah Wu, Oct 24 2018

A321009 a(1)=2; thereafter a(n) is obtained by applying Eric Angelini's remove-repeated-digits map, x->A320486(x), to n*a(n-1), stopping when 0 is reached.

Original entry on oeis.org

2, 4, 12, 48, 240, 10, 70, 560, 54, 540, 5940, 71280, 9240, 129360, 19, 304, 5168, 93024, 145, 29, 609, 198, 0
Offset: 1

Views

Author

N. J. A. Sloane, Nov 03 2018

Keywords

Examples

			a(5)=240, so for a(6) we compute 6*240 = 1440 which becomes 10 = a(6).
		

References

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

Crossrefs

Showing 1-3 of 3 results.