login
A252481
Numbers whose set of digits is simply connected to 1.
0
1, 10, 11, 12, 21, 100, 101, 102, 110, 111, 112, 120, 121, 122, 123, 132, 201, 210, 211, 212, 213, 221, 231, 312, 321, 1000, 1001, 1002, 1010, 1011, 1012, 1020, 1021, 1022, 1023, 1032, 1100, 1101, 1102, 1110, 1111, 1112, 1120, 1121, 1122, 1123, 1132, 1200, 1201, 1202, 1203, 1210, 1211, 1212, 1213, 1220, 1221, 1222, 1223
OFFSET
1,2
COMMENTS
"Simply connected" means that there must not be a "hole" in the set of digits. E.g., {1,2,4} would not be allowed since '3' is missing.
PROG
(PARI) is(n)={d=Set(digits(n)); d[1]==1 || (#d>1&&d[2]==1) || return; d[#d]==#d-!d[1]}
(Python)
def ok(n):
s = set(str(n)); return '1' in s and len(s) == ord(max(s))-ord(min(s))+1
def aupto(nn): return [m for m in range(1, nn+1) if ok(m)]
print(aupto(1223)) # Michael S. Branicky, Jan 10 2021
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Dec 24 2014
STATUS
approved