Svoboda | Graniru | BBC Russia | Golosameriki | Facebook
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A031972 a(n) = Sum_{k=1..n} n^k. 10
0, 1, 6, 39, 340, 3905, 55986, 960799, 19173960, 435848049, 11111111110, 313842837671, 9726655034460, 328114698808273, 11966776581370170, 469172025408063615, 19676527011956855056, 878942778254232811937, 41660902667961039785742, 2088331858752553232964199 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Sum of lengths of longest ending contiguous subsequences with the same value over all s in {1,...,n}^n: a(n) = Sum_{k=1..n} k*A228273(n,k). a(2) = 6 = 2+1+1+2: [1,1], [1,2], [2,1], [2,2]. - Alois P. Heinz, Aug 19 2013
a(n) is the expected wait time to see the contiguous subword 11...1 (n copies of 1) over all infinite sequences on alphabet {1,2,...,n}. - Geoffrey Critzer, May 19 2014
a(n) is the number of sequences of k elements from {1,2,...,n}, where 1<=k<=n. For example, a(2) = 6, counting the sequences, [1], [2], [1,1], [1,2], [2,1], [2,2]. Equivalently, a(n) is the number of bar graphs having a height and width of at most n. - Emeric Deutsch, Jan 24 2017.
In base n, a(n) has n+1 digits: n 1's followed by a 0. - Mathew Englander, Oct 20 2020
LINKS
A. Blecher, C. Brennan, A. Knopfmacher and H. Prodinger, The height and width of bargraphs, Discrete Applied Math. 180, (2015), 36-44.
FORMULA
a(1)=1; for n!=1 a(n) = (n^(n+1)-1)/(n-1) - 1. - Benoit Cloitre, Aug 17 2002
a(n) = A031973(n)-1 for n>0. - Robert G. Wilson v, Apr 15 2015
a(n) = n*A023037(n) = n^n - 1 + A023037(n). - Mathew Englander, Oct 20 2020
MAPLE
a:= n-> `if`(n<2, n, (n^(n+1)-n)/(n-1)):
seq(a(n), n=0..20); # Alois P. Heinz, Aug 15 2013
MATHEMATICA
f[n_]:=Sum[n^k, {k, n}]; Array[f, 30] (* Vladimir Joseph Stephan Orlovsky, Feb 14 2011*)
PROG
(Haskell)
a031972 n = sum $ take n $ iterate (* n) n
-- Reinhard Zumkeller, Nov 22 2014
(Magma) [1] cat [(n^(n+1)-n)/(n-1): n in [2..20]]; // Vincenzo Librandi, Apr 16 2015
CROSSREFS
Main diagonal of A228275.
Sequence in context: A265953 A356335 A246571 * A356439 A308861 A124577
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Dec 11 1999
EXTENSIONS
a(0)=0 prepended by Alois P. Heinz, Oct 22 2019
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 8 15:19 EDT 2024. Contains 375753 sequences. (Running on oeis4.)