Where does the claim start to hold?

The claim 2 to the power n is greater than n squared is true for n = 0 and 1, false for n = 2, 3 and 4, and true again from n = 5 on. An induction proof of it must therefore start at n = 5, and the base case matters. Your program finds the right starting point for a given range.

What to build

A program that finds the smallest start s such that 2^n > n^2 for all n from s to N.

Requirements

  • Read N.
  • Print the smallest s with 0 ≤ s ≤ N such that 2**n > n*n holds for every n from s to N.
  • If the claim fails at n = N itself, no start works: print none.

Input

One whole number N.

Output

One line: s or none.

Constraints

0 ≤ N ≤ 200.

Example

Input:

10

Output:

5

Why it works

An induction proof needs a base case at which the claim is true and a step that keeps it true. For 2^n > n^2 the step works from n = 5 on, so the claim holds from 5, even though it is true by accident for n = 0 and 1. Scanning downwards from N finds the last failure, and the next number is the first n of the unbroken run.

Examples

Example 1 · Input
10
Expected output
5
Example 2 · Input
3
Expected output
none

Prompts inside input() are ignored when checking, so input("n: ") is fine.

Hints

Hint 1

The statement is 2**n > n*n. Test it for each n from 0 up to N.

Hint 2

You want the smallest start s such that the statement holds for every n from s to N.

Hint 3

Work from n = N downwards and stop at the first n where the statement fails; the answer is n + 1. If it fails at N itself, print none.

Solution

Show one correct solution (try it yourself first)
N = int(input())
start = N + 1
n = N
while n >= 0 and 2 ** n > n * n:
    start = n
    n -= 1
print(start if start <= N else "none")

▶ Open this solution in the compiler, then press Visualize to watch it run step by step

Lesson: Mathematical induction →