login
Numbers with distinct decimal digits.
86

%I #66 Feb 07 2024 01:16:17

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

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

%U 53,54,56,57,58,59,60,61,62,63,64,65,67,68,69,70,71,72,73,74,75,76,78,79,80,81,82,83,84,85,86,87,89,90,91,92,93,94,95,96,97,98,102,103,104,105,106,107,108,109,120

%N Numbers with distinct decimal digits.

%C More than the usual number of terms are displayed in order to show the difference from some closely related sequences.

%C Also: a(1) = 0; a(n) = Min{x integer | x > a(n-1) and all digits to base 10 are distinct}.

%C This sequence is finite: a(8877691) = 9876543210 is the last term; a(8877690) = 9876543201. The largest gap between two consecutive terms before a(249999) = 2409653 is 104691, as a(175289) = 1098765, a(175290) = 1203456. - _Reinhard Zumkeller_, Jun 23 2001

%C Complement of A109303. - _David Wasserman_, May 21 2008

%C For the analogs in other bases b, search for "xenodromes." A001339(b-1) is the number of base b xenodromes for b >= 2. - _Rick L. Shepherd_, Feb 16 2013

%C A073531 gives the number of positive n-digit numbers in this sequence. Note that it does not count 0. - _T. D. Noe_, Jul 09 2013

%C Can be seen as irregular table whose n-th row holds the n-digit terms; length of row n is then A073531(n) = 9*9!/(10-n)! except for n = 1 where we have 10 terms, unless 0 is considered to belong to a row 0. - _M. F. Hasler_, Dec 10 2018

%H Reinhard Zumkeller, <a href="/A010784/b010784.txt">Table of n, a(n) for n = 1..10000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Digit.html">Digit</a>

%F A178788(a(n)) = 1; A178787(a(n)) = n; A043537(a(n)) = A055642(a(n)). - _Reinhard Zumkeller_, Jun 30 2010

%F A107846(a(n)) = 0. - _Reinhard Zumkeller_, Jul 09 2013

%t Select[Range[0,100], Max[DigitCount[#]] == 1 &] (* _Harvey P. Dale_, Apr 04 2013 *)

%o (Haskell)

%o a010784 n = a010784_list !! (n-1)

%o a010784_list = filter ((== 1) . a178788) [1..]

%o -- _Reinhard Zumkeller_, Sep 29 2011

%o (PARI) is(n)=my(v=vecsort(digits(n)));v==vecsort(v,,8) \\ _Charles R Greathouse IV_, Sep 17 2012

%o (PARI) select( is(n)=!n||#Set(digits(n))==logint(n,10)+1, [0..120]) \\ _M. F. Hasler_, Dec 10 2018

%o (PARI) apply( A010784_row(n,L=List(if(n>1,[])))={forvec(d=vector(n,i,[0,9]),forperm(d,p,p[1]&&listput(L,fromdigits(Vec(p)))),2);Set(L)}, [1..2]) \\ A010784_row(n) returns all terms with n digits. - _M. F. Hasler_, Dec 10 2018

%o (Python)

%o A010784_list = [n for n in range(10**6) if len(set(str(n))) == len(str(n))] # _Chai Wah Wu_, Oct 13 2019

%o (Python) # alternate for generating full sequence

%o from itertools import permutations

%o afull = [0] + [int("".join(p)) for d in range(1, 11) for p in permutations("0123456789", d) if p[0] != "0"]

%o print(afull[:100]) # _Michael S. Branicky_, Aug 04 2022

%o (Scala) def hasDistinctDigits(n: Int): Boolean = {

%o val numerStr = n.toString

%o val digitSet = numerStr.split("").toSet

%o numerStr.length == digitSet.size

%o }

%o (0 to 99).filter(hasDistinctDigits) // _Alonso del Arte_, Jan 09 2020

%Y Subsequence of A043096.

%Y Cf. A109303, A029740 (odds), A029741 (evens), A029743 (primes), A001339.

%K nonn,base,fini

%O 1,3

%A _N. J. A. Sloane_

%E Offset changed to 1 and first comment adjusted by _Reinhard Zumkeller_, Jun 14 2010