Saw the Stick Saw the Stick
DE JA English

An enormous puppy was looking down at her with large round eyes, and feebly stretching out one paw, trying to touch her. "Poor little thing!" said Alice, in a coaxing tone, and she tried hard to whistle to it; but she was terribly frightened all the time at the thought that it might be hungry, in which case it would be very likely to eat her up in spite of all her coaxing.

Hardly knowing what she did, she picked up a little bit of stick, and held it out to the puppy; whereupon the puppy jumped into the air off all its feet at once, with a yelp of delight, and rushed at the stick, and made believe to worry it; then Alice dodged behind a great thistle, to keep herself from being run over; and the moment she appeared on the other side, the puppy made another rush at the stick, and tumbled head over heels in its hurry to get hold of it; then Alice, thinking it was very like having a game of play with a cart-horse, and expecting every moment to be trampled under its feet, ran round the thistle again; then the puppy began a series of short charges at the stick, running a very little way forwards each time and a long way back, and barking hoarsely all the while, till at last it sat down a good way off, panting, with its tongue hanging out of its mouth, and its great eyes half shut.

"Alice's Adventures in Wonderland." Lewis Carroll

A stick I found that weighed two pound:
I sawed it up one day
In pieces eight of equal weight!
How much did each piece weigh?
(Everybody says “a quarter of a pound”, which is wrong.)

"Puzzles from Wonderland." Lewis Carroll

The robots want to saw the stick in several pieces. The length of the stick is N inches. We should help our robots saw the stick. All of the parts should have integer lengths (1, 2, 3 .. inches, but not 1.2). As we love the numerical series and especially the Triangular numbers ( read more about Triangular numbers on Wikipedia ), you should saw the stick so that the lengths form the consecutive fragment of the Triangular numbers series with the maximum quantity (fragment's length). The parts should have different lengths (no repeating). For example: 64 should divided at 15, 21, 28 , because 28, 36 is shorter and 1, 3, 15, 45 is not a consecutive fragment.

You are given a length of the stick (N). You should return the list of lengths (integers) for the parts in ascending order. If it's not possible and the problem does not have a solution, then you should return an empty list.

sawing sawing

Input: A length of the stick as an integer.

Output: A fragment of the Triangular numbers as a list of integers (sorted in ascending order) or an empty list.


checkio(64) == [15, 21, 28]
checkio(371) == [36, 45, 55, 66, 78, 91]
checkio(225) == [105, 120]
checkio(882) == []

How it is used: In this task you will learn about triangular numbers. A triangular number or triangle number counts the objects that form an equilateral triangle. This is an interesting sequence which has various applications.
Here’s a real world application: In a competitive tournament format that uses a round-robin group stages, the number of matches that need to be played between n teams is equal to the triangular number T n−1 . For example, a group stage with 4 teams requires 6 matches, and a group stage with 8 teams requires 28 matches.

Precondition: 0 < length < 1000

Become Awesome

  • No Ads
  • No Limits
  • More Content
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

<< <
> >>
exec show

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Go to the next mission