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!)
A002021 Pile of coconuts problem: (n-1)*(n^n - 1), n even; n^n - n + 1, n odd.
(Formerly M3114 N1262)
6
1, 3, 25, 765, 3121, 233275, 823537, 117440505, 387420481, 89999999991, 285311670601, 98077104930805, 302875106592241, 144456088732254195, 437893890380859361, 276701161105643274225, 827240261886336764161, 668888937280041138782191, 1978419655660313589123961 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
This is a generalization (from n = 5) of Ben Ames Williams's published problem. For a given n, the problem is effectively as follows. A successful monkey-share process removes 1 coconut for a monkey followed by an exact share of 1/n from the coconut pile. Determine the least initial number of coconuts for a monkey-share to succeed n times, leaving a multiple of n to be shared equally at the end. The problem in the D'Agostino link is slightly different, requiring a coconut for the monkey in the final division. - Peter Munn, Jun 14 2023
REFERENCES
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Anonymous, The Monkey and the Coconuts (with FormulaOne program)
R. S. Underwood and Robert E. Moritz, Problem 3242, Amer. Math. Monthly, 35 (1928), 47-48.
FORMULA
E.g.f.: (1-x)*exp(x)-(W(x)+2)*(2*W(x)+1)/(2*(1+W(x))^3)-W(-x)/(2*(1+W(-x))^3) where W is the Lambert W function. - Robert Israel, Aug 26 2016
a(n) = 1-n-(-n)^n+(1+(-1)^n)*n^(n+1)/2. - Wesley Ivan Hurt, Nov 09 2023
MAPLE
seq(`if`(n::even, (n-1)*(n^n - 1), n^n-n+1), n=1..30); # Robert Israel, Aug 26 2016
MATHEMATICA
Table[If[EvenQ[n], (n-1)(n^n-1), n^n-n+1], {n, 30}] (* Harvey P. Dale, Apr 21 2012 *)
PROG
(Python)
def a(n): return (n-1)*(n**n - 1) if n%2 == 0 else n**n - n + 1
print([a(n) for n in range(1, 20)]) # Michael S. Branicky, Feb 07 2022
CROSSREFS
Sequence in context: A365359 A062411 A136516 * A322063 A350902 A306792
KEYWORD
easy,nonn,nice
AUTHOR
EXTENSIONS
More terms from Harvey P. Dale, Apr 21 2012
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 April 18 22:18 EDT 2024. Contains 371782 sequences. (Running on oeis4.)