Hop-Frog

  

  “What is the diversion?” “We call it the Eight Chained
  Ourang-Outangs”…A long chain was now procured. First, it was passed
  about the waist of the king, and tied, then about another of the
  party, and also tied; then about all successively, in the same manner…
  The party stood as far apart from each other as possible, they formed
  a circle…Hop-Frog passed the residue of the chain in two diameters, at
  right angles, across the circle…

The rest of the story is well-known: Hop-Frog burnt alive the cruel king
and his seven ministers with the help of Trippetta, and afterwards they
escaped home. Now Hop-Frog is wondering if he could have tied those
nobles differently. He is considering situations where n nobles are tied
in a circle, and where each noble may be additionally tied to exactly
another noble (different from the one to his left or to his right), with
a straight chain that crosses at most another straight chain. Below, on
the left you can see the original situation of the story. On the center
you can see another possibility for n = 8. On the right you can see one
of the many possibilities for n = 16. Note that for n ≤ 3 there is just
one possibility, namely no additional chains at all.

(64,16)

(0,8)0.40(0,8) (2.3431,13.6569)0.41(2.3431,13.6569) (8,16)0.42(8,16)
(13.6569,13.6569)0.43(13.6569,13.6569) (16,8)0.44(16,8)
(13.6569,2.3431)0.45(13.6569,2.3431) (8,0)0.46(8,0)
(2.3431,2.3431)0.47(2.3431,2.3431)

(24,8)0.410(24,8) (26.3431,13.6569)0.411(26.3431,13.6569)
(32,16)0.412(32,16) (37.6569,13.6569)0.413(37.6569,13.6569)
(40,8)0.414(40,8) (37.6569,2.3431)0.415(37.6569,2.3431)
(32,0)0.416(32,0) (26.3431,2.3431)0.417(26.3431,2.3431)

(48,8)0.420(48,8) (50.3431,13.6569)0.421(50.3431,13.6569)
(56,16)0.422(56,16) (61.6569,13.6569)0.423(61.6569,13.6569)
(64,8)0.424(64,8) (61.6569,2.3431)0.425(61.6569,2.3431)
(56,0)0.426(56,0) (50.3431,2.3431)0.427(50.3431,2.3431)

(63.391,11.0614)0.430(63.391,11.0614)
(48.609,11.0614)0.431(48.609,11.0614)
(63.391,4.9386)0.432(63.391,4.9386) (48.609,4.9386)0.433(48.609,4.9386)
(59.0614,15.391)0.434(59.0614,15.391)
(59.0614,0.609)0.435(59.0614,0.609)
(52.9386,15.391)0.436(52.9386,15.391)
(52.9386,0.609)0.437(52.9386,0.609)

Hop-Frog plans to keep killing the maximum number of nobles, but he
could be bewildered by too many possible ways to tie them. To help
Hop-Frog with his exquisite purpose, please compute the maximum number
of nobles n for which there are at most x ways to tie them.

Input

Input consists in several test cases, each one with an integer number x
between 1 and 10¹⁸.

Output

For every case, print its number followed by the maximum number of
nobles n for which there are at most x ways to tie them.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T11:58:49.169Z

© Jutge.org, 2006–2026.
https://jutge.org
