A366960 Numbers whose difference between the largest and smallest digits is equal to 3.
14, 25, 30, 36, 41, 47, 52, 58, 63, 69, 74, 85, 96, 103, 114, 124, 130, 134, 141, 142, 143, 144, 203, 214, 225, 230, 235, 241, 245, 252, 253, 254, 255, 300, 301, 302, 303, 310, 314, 320, 325, 330, 336, 341, 346, 352, 356, 363, 364, 365, 366, 411, 412, 413, 414
Offset: 1
Links
- Stefano Spezia, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Mathematica
Select[Range[415],Max[d=IntegerDigits[#]]-Min[d]==3 &]
-
PARI
isok(n) = my(d=digits(n)); vecmax(d) - vecmin(d) == 3; \\ Michel Marcus, Nov 05 2023
-
Python
def ok(n): return max(d:=list(map(int, str(n))))-min(d) == 3 print([k for k in range(420) if ok(k)]) # Michael S. Branicky, Oct 30 2023
-
Python
from itertools import chain, count, islice, combinations_with_replacement from sympy.utilities.iterables import multiset_permutations def A366960_gen(): # generator of terms return chain.from_iterable(sorted(int(''.join(str(d) for d in t)) for a in range(7) for c in combinations_with_replacement(range(a,a+4),l) for t in multiset_permutations((a,a+3)+c) if t[0]) for l in count(0)) A366960_list = list(islice(A366960_gen(),30)) # Chai Wah Wu, Nov 10 2023
Comments