Submeter | Todas submissőes | Melhores | Voltar |
Problem hidden
APS - Amazing Prime Sequence |
Bablu is very fond of Series and Sequences...
After studying Fibonacci Series in Class IX, he was impressed and he designed his own sequence as follows...
a[0] = a[1] = 0
For n > 1, a[n] = a[n - 1] + f(n), where f(n) is smallest prime factor of n.
He is also very fond of programming and thus made a small program to find a[n], but since he is in Class IX, he is not very good at programming. So, he asks you for help. Your task is to find a[n] for the above sequence....
Input
Your code will be checked for multiple test cases.
First line of Input contains T (≤ 100), the number of test cases.
Next T lines contain a single number N. (1 < N < 107).
Output
Single line containing a[n] i.e. nth number of the sequence for each test case.
Example
Input: 3 2 3 4 Output: 2 5 7
Adicionado por: | c[R]@zY f[R]0G |
Data: | 2013-02-14 |
Tempo limite: | 1s |
Tamanho do fonte: | 5000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Linguagem permitida: | Todas exceto: ASM64 CLOJURE ERL FSHARP PERL6 PY_NBC SCALA TCL |