Odd Catalan numbers P75985


Statement
 

pdf   zip

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

You are given an index ii. What is the smallest jj such that jij \ge i and CjC_j is odd?

Input

Input consists of several cases, each with a natural number no larger than 101510^{15}.

Output

For every ii, print the smallest jj such that jij \ge i and CjC_j is odd. If such a number does not exist, print “Catalans are strange!”.

Public test cases
  • Input

    0
    1
    2
    3
    1099511627768
    

    Output

    0
    1
    3
    3
    1099511627775
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++