← RoseCode

ROSECODE 523

Sum of largest prime factors revisited

liuguangxi · Math ·

Let f(n) be the largest prime factor of n. For example f(1)=0, f(6)=3 and f(30)=5.

Define S(k,n)=x1=1nx2=1nxk=1nf(i=1kxi).

You are given S(2,3) = f(1×1) + f(1×2) + f(1×3) + f(2×1) + f(2×2) + f(2×3) + f(3×1) + f(3×2) + f(3×3) = 21, S(3,10)=4790, S(6,10)=5697722.

Find S(9,109)mod109.
Thanks to baihacker for the idea.

This problem was inspired by Problem 642 at Project Euler (https://projecteuler.net/problem=642)