|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
The number of n-digit terms is 29*5^(n-1) - 47*4^(n-1) + 2*3^(n+1).
|
|
LINKS
|
|
|
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
(PARI) isok(n) = my(d=digits(n)); vecmax(d) - vecmin(d) == 4; \\ Michel Marcus, Nov 05 2023
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|