OFFSET
1,2
COMMENTS
For n < 10 there are n! distinct numbers.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..369
FORMULA
EXAMPLE
a(3) = floor((123 + 132 + 213 + 231 + 312 + 321)/6) = 222;
a(4) = floor((1234 + 1243 + 1324 + 1342 + 1423 + 1432 + ... + 4312 + 4321)/24) = 66660/24 = 2777.
MAPLE
a:= proc(n) local s, t, l;
s:= cat("", seq(i, i=1..n)); t:= length(s);
l:= (p-> seq(coeff(p, x, i), i=0..9))(add(x^parse(s[i]), i=1..t));
floor((10^t-1)/9*add(i*l[i+1], i=1..9)/t)
end:
seq(a(n), n=1..20); # Alois P. Heinz, Jan 05 2019
PROG
(PARI) { a(n) = c=vector(10); for(i=1, n, s=eval(Vec(Str(i))); for(j=1, #s, c[s[j]+1]++); ); l=sum(j=1, 10, c[j]); (10^l-1)/9*sum(j=1, 10, (j-1)*c[j])\l } \\ Max Alekseyev
(Python)
def A078266(n):
s = ''.join(str(i) for i in range(1, n+1))
return sum(int(d) for d in s)*(10**len(s)-1)//(9*len(s)) # Chai Wah Wu, Jan 04 2019
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Nov 24 2002
EXTENSIONS
More terms from Max Alekseyev, Jan 24 2012
STATUS
approved