The lightest pearl P11914


Statement
 

pdf   zip

thehtml

“Given eight identical pearls, except for one that is a little lighter, how do you find which one is the lightest pearl with only two weighings?”

This is the last problem that the seven sages put to Beremiz, who solved the problem easily.

Input

Input consists of several cases, each with a natural number p between 1 and 109.

Output

For every case, print the minimum number of the weighings to identify with certainty, given p identical pearls, except for one that is a little lighter, which is the lightest pearl. Suppose that the scale can only compare the weight of two groups with the same (arbitrarily large) number of pearls.

Public test cases
  • Input

    8
    10
    1
    

    Output

    2
    3
    0
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Salvador Roura
    Original language
    Spanish
    Other languages
    Spanish
    Official solutions
    C++
    User solutions
    C++ Python