Odd Catalan numbers

The famous Catalan numbers can be defined by the recurrence
$$C_n = \sum_{i=0}^{n-1} C_i \cdot C_{n-i-1} \enspace ,$$
with C₀ = 1. The first Catalan numbers are 1, 1, 2, 5, 14, 42, 132, …

You are given an index i. What is the smallest j such that j ≥ i and
C_(j) is odd?

Input

Input consists of several cases, each with a natural number no larger
than 10¹⁵.

Output

For every i, print the smallest j such that j ≥ i and C_(j) is odd. If
such a number does not exist, print “Catalans are strange!”.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T11:52:06.136Z

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