LearnPy Hub
← Arena
IntermediateRating 1400

Longest Collatz Chain

For starting values 1..n, find the one whose Collatz sequence (halve if even, 3x+1 if odd, until 1) is longest. Print that start and its number of steps; on ties, the smaller start.

Input

One integer n (1 ≤ n ≤ 2·10⁵).

Output

start steps

Sample 1

Input
10
Output
9 19

Sample 2

Input
1
Output
1 0
solution.py
Output appears here
Longest Collatz Chain · Python Arena problem · LearnPy Hub