login
A182402
Total number of digits in n-th row of a triangle formed by the positive integers.
3
1, 2, 3, 5, 10, 12, 14, 16, 18, 20, 22, 24, 26, 34, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 171, 184, 188, 192, 196, 200, 204, 208, 212, 216, 220, 224, 228, 232
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).
The rows of nonlinearity are given by A068092. - Jon Perry, May 26 2013
LINKS
FORMULA
a(n) = A058183(A000217(n)) - A058183(A000217(n-1)), n >= 2. - Omar E. Pol, Jun 25 2012
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
Cf. A055642, A226029 (first differences).
Cf. A068092.
Sequence in context: A002263 A249991 A039022 * A079251 A171785 A050051
KEYWORD
nonn,base
AUTHOR
Dave Durgin, Jun 19 2012
EXTENSIONS
Better definition from Omar E. Pol, Jun 25 2012
STATUS
approved