#P6028. Summing a Multiplicative Function Based on Prime Factorization

    ID: 19252 Type: Default 1000ms 256MiB

Summing a Multiplicative Function Based on Prime Factorization

Summing a Multiplicative Function Based on Prime Factorization

Consider a function \( f(n) \) defined for all positive integers \( n \) as follows:

For \( n = 1 \), define \( f(1) = 1 \). For any \( n \ge 2 \) with prime factorization \[ n=\prod_{i=1}^k p_i^{\alpha_i}, \] we define \[ f(n)= \prod_{i=1}^k \frac{p_i^{\alpha_i+1}-1}{p_i^{\alpha_i+1}-p_i^{\alpha_i}}. \]

Your task is to calculate the sum \[ S=\sum_{i=1}^n f(i), \] for a given positive integer \( n \). The answer should be printed with a precision of 6 decimal places.

Note: Use \( f(1)=1 \) as defined.

inputFormat

The input consists of a single line containing an integer \( n \) (where \( 1 \leq n \leq 10^4 \) for practical purposes).

outputFormat

Output the value of \( S = \sum_{i=1}^n f(i) \) with exactly 6 decimal places.

sample

1
1.000000