OFFSET
1,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..385
FORMULA
a(n) = {n^n + n^(n-1) -2}/(n-1), for n>1.
E.g.f.: 2*x*Ei(-W(-x)) - 2*x*Ei(x) + W(-x) + 2*exp(x) - 2, where Ei(x) is the exponential integral and W(x) is the Lambert W function. - G. C. Greubel, Sep 21 2022
MATHEMATICA
Table[If[n==1, 1, (n^n +n^(n-1) -2)/(n-1)], {n, 30}] (* G. C. Greubel, Sep 21 2022 *)
PROG
(PARI) a(n) = sum(k=0, n-1, n^k) + sum(k=0, n-2, n^k); \\ Michel Marcus, Feb 03 2014
(Magma) [1] cat [(n^n +n^(n-1) -2)/(n-1): n in [2..30]]; // G. C. Greubel, Sep 21 2022
(SageMath)
def A077386(n): return 1 if (n==1) else (n^n +n^(n-1) -2)/(n-1)
[A077386(n) for n in (1..30)] # G. C. Greubel, Sep 21 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Nov 06 2002
EXTENSIONS
More terms from Michel Marcus, Feb 03 2014
STATUS
approved