SP19975 APS2 - Amazing Prime Sequence (hard)
Description
This problem is a harder version of [APS](../APS).
Let $ f(n) $ be the smallest prime factor of $ n $ . For example, $ f(2) = 2,\ f(4) = 2 $ and $ f(35) = 5 $ .
The sequence $ S(n) $ is defined for all positive integers as follows:
\- $ S(1) = 0 $
\- $ S(n) = S(n-1) + f(n) $ (if $ n \ge 2 $ )
Given $ N $ , find $ S(N) $ **modulo** $ 2^{64} $ .
Input Format
N/A
Output Format
N/A