Little Monty and Fibonacci

3

5 votes
Hard, Number Theory, Algorithms, Mathematics, Open, Approved
Problem

Little Monty is very fond of Fibonacci numbers and challenges his friend Lopa that he can solve any question regarding the same. Lopa however is jealous and after thinking for a long time came up with a problem.
She says given N(the number of fibonacci numbers) one has to count all the multiples of all the fibonacci numbers. This statement can be quite confusing hence look at the mathematical definition and test cases for better understanding.
Let M(x) denote the number of multiple of x in the sequence and F(y) denote the yth fibonacci number. The required answer is:
enter image description here Take the first two number of the sequence to be 1 and 1.

Input Format
The first line contains T i.e. the number of test cases.
T lines follow, each line containing an integer, N.
(The sample fibonacci series for n=5 is 1, 1, 2, 3, 5)

Output Format
For each testcase, print the output that Lopa wants in one line.

Constraints
1 ≤ T ≤ 1000
1 ≤ N ≤ 1000

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation
  1. For N=1. The fibonacci number is 1. The multiple of 1 is 1(itself). Hence the answer is 1.
  2. For N=2. The fibonacci number is 1, 1. The multiple of 1(first fibonacci number) is 1(first fibonacci number) and 1(second fibonacci number). The multiple of 1(second fibonacci number) is 1(first fibonacci number) and 1(second fibonacci number). Hence the answer is 4.
  3. For n=3. The fibonacci sequence is 1, 1, 2 . The multiples of 1(first fibonacci number) is 1(itself) and 1(second fibonacci number) and 2. The multiples of 1(second fibonacci number) is 1(first fibonacci number), 1(itself) and 2. The multiple of 2 is 2(itself). Hence the answer is 7.
Editor Image

?