We have Infinitely Many Choclates and infinitely many children . And, We want to give them to children, But we will not give More than 'N' choclates to any one child. And, we want to give 'N' choclates to exactly 1 child.
And, We want to give thechoclates to as many children possible, in a beautiful sequence only.
A beautiful sequence is an increasing sequence, in which a term Ai divides all Aj, where j>i.
Forexample: 3, 6, 24 is a beautiful sequence of length 3.
We would give
The first line contains T, the total number ofTestcases. Then Each of the next T lines, contains an integer denoting -'N'.
In the Third case,N=24 1 divides 3,6,12 and 24 3 divides 6,12, and 24. 6 divides 12 and 24 12 divides 24 We can't give more than 24 choclates to any child, So We have to stop and this is the max. length achievable i.e.5
In the Fourth Case , N=3 1 divides 3 . So We have to stop And this is the max. length achievable i.e. 2choclates, 3 is divisible by 1.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.