OFFSET
1,2
FORMULA
For odd n, a(n) = n^(n-1) + (n-1)/2; for even n, a(n) = n^(n-1) + n - 1. Alternatively, a(n) = n^(n-1) + (n-1)/(1 + (n mod 2)). - Max Alekseyev, Oct 23 2008
MATHEMATICA
Table[If[OddQ[n], n^(n-1)+(n-1)/2, n^(n-1)+n-1], {n, 20}] (* Harvey P. Dale, Oct 04 2020 *)
PROG
(PARI) { a(n) = n^(n-1)+(n-1)/(n%2 + 1) } \\ Max Alekseyev, Oct 23 2008
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Mar 21 2003
EXTENSIONS
More terms and formula from Max Alekseyev, Oct 23 2008
STATUS
approved