about | help | code help+videos | done | prefs |
The Lazy Caterer’s Sequence: Formally also known as the central polygonal numbers, it describes the maximum number of pieces (or bounded/unbounded regions) of a circle (a pancake or pizza is usually used to describe the situation) that can be made with a given number of straight cuts. For example, three cuts across a pancake will produce six pieces if the cuts all meet at a common point, but seven if they do not. The maximum number p of pieces that can be created with a given number of cuts n, where n ≥ 0, is given by the formula (n^2 + n + 2) / 2. Return this sequence as a List given some number of terms. lazyCaterer(1) → [1] lazyCaterer(6) → [1, 2, 4, 7, 11, 16] lazyCaterer(4) → [1, 2, 4, 7] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 200 Post-solution available
Copyright Nick Parlante 2017 - privacy