login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A366961
Numbers whose difference between the largest and smallest digits is equal to 4.
9
15, 26, 37, 40, 48, 51, 59, 62, 73, 84, 95, 104, 115, 125, 135, 140, 145, 151, 152, 153, 154, 155, 204, 215, 226, 236, 240, 246, 251, 256, 262, 263, 264, 265, 266, 304, 315, 326, 337, 340, 347, 351, 357, 362, 367, 373, 374, 375, 376, 377, 400, 401, 402, 403, 404, 410
OFFSET
1,1
COMMENTS
The number of n-digit terms is 29*5^(n-1) - 47*4^(n-1) + 2*3^(n+1).
MATHEMATICA
Select[Range[410], Max[d=IntegerDigits[#]]-Min[d]==4 &]
PROG
(Python)
def ok(n): return max(d:=list(map(int, str(n))))-min(d) == 4
print([k for k in range(411) if ok(k)]) # Michael S. Branicky, Oct 30 2023
(PARI) isok(n) = my(d=digits(n)); vecmax(d) - vecmin(d) == 4; \\ Michel Marcus, Nov 05 2023
CROSSREFS
Cf. A037904.
Cf. A010785 (difference = 0), A366958 (difference = 1), A366959 (difference = 2), A366960 (difference = 3), A366962 (difference = 5), A366963 (difference = 6), A366964 (difference = 7), A366965 (difference = 8), A366966 (difference = 9).
Sequence in context: A191915 A359547 A189045 * A032609 A050699 A097393
KEYWORD
nonn,base,easy
AUTHOR
Stefano Spezia, Oct 30 2023
STATUS
approved