|
|
A366964
|
|
Numbers whose difference between the largest and smallest digits is equal to 7.
|
|
9
|
|
|
18, 29, 70, 81, 92, 107, 118, 128, 138, 148, 158, 168, 170, 178, 181, 182, 183, 184, 185, 186, 187, 188, 207, 218, 229, 239, 249, 259, 269, 270, 279, 281, 289, 292, 293, 294, 295, 296, 297, 298, 299, 307, 318, 329, 370, 381, 392, 407, 418, 429, 470, 481, 492
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
The number of n-digit terms is 23*8^(n-1) - 41*7^(n-1) + 2^n*3^(n+1).
|
|
LINKS
|
|
|
MATHEMATICA
|
Select[Range[500], Max[d=IntegerDigits[#]]-Min[d]==7 &]
|
|
PROG
|
(Python)
def ok(n): return max(d:=list(map(int, str(n))))-min(d) == 7
(PARI) isok(n) = my(d=digits(n)); vecmax(d) - vecmin(d) == 7; \\ Michel Marcus, Nov 05 2023
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|