cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-4 of 4 results.

A002021 Pile of coconuts problem: (n-1)*(n^n - 1), n even; n^n - n + 1, n odd.

Original entry on oeis.org

1, 3, 25, 765, 3121, 233275, 823537, 117440505, 387420481, 89999999991, 285311670601, 98077104930805, 302875106592241, 144456088732254195, 437893890380859361, 276701161105643274225, 827240261886336764161, 668888937280041138782191, 1978419655660313589123961
Offset: 1

Views

Author

Keywords

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).

Crossrefs

Programs

  • 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 *)
  • 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

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

Extensions

More terms from Harvey P. Dale, Apr 21 2012

A002022 In the pile of coconuts problem, the number of coconuts that remain to be shared equally at the end of the process.

Original entry on oeis.org

0, 6, 240, 1020, 78120, 279930, 40353600, 134217720, 31381059600, 99999999990, 34522712143920, 106993205379060, 51185893014090744, 155568095557812210, 98526125335693359360, 295147905179352825840, 239072435685151324847136
Offset: 2

Views

Author

Keywords

Comments

See A002021 for further description of the problem.

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).

Crossrefs

Programs

  • Maple
    f := proc(n) if n mod 2 = 1 then RETURN((n-1)^n-(n-1)) else RETURN((n-1)^(n+1)-(n-1)) fi; end:
  • Mathematica
    Rest[Table[If[OddQ[n],(n-1)^n-(n-1),(n-1)^(n+1)-(n-1)],{n,30}]] (* Harvey P. Dale, Oct 21 2011 *)

Extensions

Formula and more terms from James Sellers, Feb 10 2000
Detail added to the name by Peter Munn, Jun 16 2023

A254029 Positive solutions of Monkey and Coconuts Problem for the classic case (5 sailors, 1 coconut to the monkey): a(n) = 15625*n - 4 for n >= 1.

Original entry on oeis.org

15621, 31246, 46871, 62496, 78121, 93746, 109371, 124996, 140621, 156246, 171871, 187496, 203121, 218746, 234371, 249996, 265621, 281246, 296871, 312496, 328121, 343746, 359371, 374996, 390621, 406246, 421871, 437496, 453121, 468746
Offset: 1

Views

Author

Luciano Ancora, Mar 14 2015

Keywords

Comments

References

  • Charles S. Ogilvy and John T. Anderson, Excursions in Number Theory, Oxford University Press, 1966, pages 52-54.
  • Miodrag S. Petković, "The sailors, the coconuts, and the monkey", Famous Puzzles of Great Mathematicians, Amer. Math. Soc.(AMS), 2009, pages 52-56.

Crossrefs

Programs

  • Mathematica
    s = 5; c = 1; Table[n s^(s + 1) - c (s - 1), {n, 1, 30}] (* or *)
    CoefficientList[Series[(15621 + 4 x)/(-1 + x)^2, {x, 0, 29}], x]

Formula

G.f.: x*(15621 + 4*x)/(1 - x)^2.
a(n) = 2*a(n-1) - a(n-2) = a(n-1) + 15625, with a(0) = -4 and a(-1) = -(4 + 5^6). a(n) = 5^6*n - 4.
a(n) = (15*c(n) + 11) + 265*(c(n) + 1)/2^10, with c(n) = A158421(n) = 2^10*n - 1, for n >= 1. - Richard S. Fischer and Wolfdieter Lang, Jun 01 2023

A193871 Square array T(n,k) = k^n - k + 1 read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 3, 1, 1, 7, 7, 1, 1, 15, 25, 13, 1, 1, 31, 79, 61, 21, 1, 1, 63, 241, 253, 121, 31, 1, 1, 127, 727, 1021, 621, 211, 43, 1, 1, 255, 2185, 4093, 3121, 1291, 337, 57, 1, 1, 511, 6559, 16381, 15621, 7771, 2395, 505, 73, 1, 1, 1023, 19681, 65533, 78121, 46651, 16801, 4089, 721, 91, 1
Offset: 1

Views

Author

Omar E. Pol, Aug 21 2011

Keywords

Comments

The columns give 1^n-0, 2^n-1, 3^n-2, 4^n-3, 5^n-4, etc.
The main diagonal gives A006091, which is a sequence related to the famous "coconuts" problem.

Examples

			Array begins:
  1,   1,    1,     1,     1,    1,    1,   1,   1,   1
  1,   3,    7,    13,    21,   31,   43,  57,  73
  1,   7,   25,    61,   121,  211,  337, 505
  1,  15,   79,   253,   621, 1291, 2395
  1,  31,  241,  1021,  3121, 7771
  1,  63,  727,  4093, 15621
  1, 127, 2185, 16381
  1, 255, 6559
  1, 511
  1
		

Crossrefs

Row 1: A000012. Rows 2,3: A002061, A061600 but both without repetitions.
Cf. A276135.

Programs

  • Mathematica
    Table[k^# - k + 1 &[n - k + 1], {n, 11}, {k, n}] // Flatten (* Michael De Vlieger, Nov 16 2016 *)
Showing 1-4 of 4 results.