A029740 Odd numbers with distinct digits.
1, 3, 5, 7, 9, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 103, 105, 107, 109, 123, 125, 127, 129, 135, 137, 139, 143, 145, 147, 149, 153, 157
Offset: 1
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
- Patrick De Geest, World!Of Numbers
Programs
-
Mathematica
Select[Range[1, 199, 2], Max[DigitCount[#]] == 1 &] (* Harvey P. Dale, Jan 12 2019 *)
-
Python
# generates full sequence from itertools import permutations afull = sorted(set(int("".join(p)) for d in range(1, 11) for p in permutations("0123456789", d) if p[0] != "0" and p[-1] in "13579")) print(afull[:100]) # Michael S. Branicky, Aug 04 2022
-
Scala
def hasDistinctDigits(n: Int): Boolean = { val numerStr = n.toString val digitSet = numerStr.split("").toSet numerStr.length == digitSet.size } (1 to 199 by 2).filter(hasDistinctDigits) // Alonso del Arte, Jan 09 2020
Extensions
First comment corrected by Harvey P. Dale, Mar 04 2020 at the insistence of Sean A. Irvine
Offset changed to 1 by Michael S. Branicky, Aug 04 2022
Removed incorrect Sage program. - N. J. A. Sloane, Aug 04 2022
Comments