Chris is Sciurophobic
Helton Park, is known for its huge mango trees. Squirrels play around on the tree branches every morning. A tree can have up to X-1 branches, starting from 2 till X.
The squirrels gather in the branches numbered from 2 to P during mornings and only jump to those branches, that are legit multiples of their initial branch numbers. Assume a squirrel is initially seated in branch 3 it can only move to branches 6,9,12...and so on
Chris is a nature photographer and wants to seize some beautiful scenes for his upcoming projects. He finds that, he can get his perfect shot only by positioning himself on the branches of the trees. But Chris is terribly scared of squirrels. find the largest branch number that he should occupy to save himself from the hyperactive squirrels.
- Input is a single line containing P and X
- 1 ≤ P ≤ X ≤ 109
Output should contain a single integer that denotes the largest branch number, Chris should sit.
Input: 3 6 Output: 5
5 is the highest branch number that squirrels from 2 to 3 cant jump.
|Tags||campus-chapter, easy-medium, vivek_reddy|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions