The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 3 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Rohit is very fond of mathematics. He wishes to create a sequence of numbers. The nth number in the series f (n) denotes the number of occurrences of the number n in the series.
The series has first 2 elements as 1 and 2.
The sequence goes as follows:
_N_ : 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12...
f(N) : 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6 ...
Your aim is to provide the value of the function f (n) most efficiently.
The first line of input consists of a single integer t denoting number of test cases. Each of the next t lines will have an integer value n.
The output should consist of t lines, each line giving the value of function f (n) for the corresponding n.
Input: 3 10 20 100 Output: 5 8 21
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll