Prime Sequence
CodeChefOpen on judge ↗
Let F(n) denote the smallest prime factor of a number n. Output A[n] = A[n-1] + F(n), given A[0] = A[1] = 0. Input - The number of test cases t is entered first. - t lines follow which are the values of n for which answer has to be found. Output - A single number for each test case which is the value of A[n] Constraints - 1 ≤ t ≤ 20 - 0 ≤ n ≤ 1000000 Example Input: 5 1 2 3 4 5 Outp
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start