cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A078266 Integer part of the arithmetic mean of all the distinct numbers formed by permuting the digits of concatenation of numbers from 1 to n.

Original entry on oeis.org

1, 16, 222, 2777, 33333, 388888, 4444444, 49999999, 555555555, 46464646464, 4102564102563, 377777777777777, 35947712418300653, 3508771929824561403, 349206349206349206348, 35265700483091787439613, 3599999999999999999999999
Offset: 1

Views

Author

Amarnath Murthy, Nov 24 2002

Keywords

Comments

For n < 10 there are n! distinct numbers.

Examples

			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.
		

Crossrefs

Programs

  • 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
  • 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

Formula

a(n) = A007953(A007908(n))*(10^A055642(A007908(n))-1)/(9*A055642(A007908(n))). - Chai Wah Wu, Jan 06 2019

Extensions

More terms from Max Alekseyev, Jan 24 2012