|
|
A080479
|
|
Smallest number formed by using all the digits (with multiplicity) of next n numbers.
|
|
6
|
|
|
1, 23, 456, 10789, 1111112345, 101111226789, 22222222345678, 1022333333334569, 102333344444445789, 10234444455555556789, 1023455555666666666789, 102345666677777777777889, 10012345677888888888889999, 1000000011111122334455678999999999
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
PROG
|
(Python)
def a(n):
s = "".join(sorted("".join(map(str, range((n-1)*n//2+1, n*(n+1)//2+1)))))
if '0' not in s: return int(s)
rz = s.rfind('0')
return int(s[rz+1] + s[:rz+1] + s[rz+2:])
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,easy,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Apr 19 2003
|
|
STATUS
|
approved
|
|
|
|