OFFSET
1,3
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..380
FORMULA
From Peter Bala, Sep 12 2012: (Start)
a(n) = (n+1)^n - 2*n^n (since 2*n^n <= (n+1)^n < 3*n^n for n >= 1).
In terms of the tree function T(x) = Sum_{n >= 1} n^(n-1)*x^n/n! of A000169 the e.g.f. is T(x)*(2*x + T(x)*(T(x)-2))/(x^2*(T(x)-1)^3) = x + 10*x^2/2! + 113*x^3/3! + ... . (End)
a(n) = Sum_{i=1..n-1} C(n,i-1)*i^(i-1)*(n-i)^(n-i). - Vladimir Kruchinin, Sep 07 2015
MAPLE
MATHEMATICA
Table[Mod[(n+1)^n, n^n], {n, 30}]
PROG
(Magma) [(n+1)^n mod n^n: n in [1..20]]; // Vincenzo Librandi, Sep 07 2015
(PARI) first(m)=vector(m, i, ((i+1)^i) % (i^i)) \\ Anders Hellström, Sep 07 2015
(SageMath) [(n+1)^n%n^n for n in range(1, 31)] # G. C. Greubel, May 23 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Vladimir Joseph Stephan Orlovsky, Apr 26 2010
EXTENSIONS
a(19) from Vincenzo Librandi, Sep 07 2015
STATUS
approved