Tap here to switch tabs
Problem
Submissions

Problem: Smallest Value After Replacing With Prime Factor Sum

Try to solve the Smallest Value After Replacing With Sum of Prime Factors problem.

Statement

You are given a positive integer n.

Repeatedly replace n with the sum of its prime factors. Continue this replacement process until the value of n stops changing.

Return the smallest value that n takes on throughout this process.

Note: If a prime factor divides n multiple times, it must be included in the sum as many times as it divides n.

Constraints:

  • 2≤2 \leq n ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Smallest Value After Replacing With Prime Factor Sum

Try to solve the Smallest Value After Replacing With Sum of Prime Factors problem.

Statement

You are given a positive integer n.

Repeatedly replace n with the sum of its prime factors. Continue this replacement process until the value of n stops changing.

Return the smallest value that n takes on throughout this process.

Note: If a prime factor divides n multiple times, it must be included in the sum as many times as it divides n.

Constraints:

  • 2≤2 \leq n ≤105\leq 10^5