OFFSET
1,2
COMMENTS
Sequence is nonlinear at each decade transition; for example, row-5 transitions from single-digit (7) to double-digit (10) where sequence jumps (3) to (5); row-14 transitions from 2-digit (92) to 3-digit (105) where sequence jumps from (26) to (34).
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
1; .................... (row 1 contains 1 digit)
2, 3; ............... (row 2 contains 2 digits)
4, 5, 6; ........... (row 3 contains 3 digits)
7, 8, 9, 10; ....... (row 4 contains 5 digits)
11, 12, 13, 14, 15; ... (row 5 contains 10 digits)
MATHEMATICA
f[n_] := Length@ Flatten[ IntegerDigits[ Range[n (n - 1)/2 + 1, n (n + 1)/2]]]; Array[f, 58] (* Robert G. Wilson v, Sep 04 2013 *)
PROG
(Haskell)
a182402 n = a182402_list !! (n-1)
a182402_list = map (sum . map a055642) $ t 1 [1..] where
t i xs = ys : t (i + 1) zs where
(ys, zs) = splitAt i xs
-- Reinhard Zumkeller, May 26 2013
(PARI) a(n) = {my(x=n*(n-1)/2+1, y=n*(n+1)/2, nx=#Str(x), ny=#Str(y), s=0); for (i=nx, ny, if (i==nx, if (i==ny, s+=(y+1-x)*i, s+=(10^i-x)*i), if (i==ny, s+=(y+1-10^(i-1))*i, s+=i*(10^(i+1)-10^i+1)); ); ); s; } \\ Michel Marcus, Jan 26 2022
(Python)
def a(n): return len("".join(str(i) for i in range(n*(n+1)//2+1, (n+1)*(n+2)//2+1)))
print([a(n) for n in range(58)]) # Michael S. Branicky, Jan 26 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Dave Durgin, Jun 19 2012
EXTENSIONS
Better definition from Omar E. Pol, Jun 25 2012
STATUS
approved