#P9238. [蓝桥杯 2023 省 A] 翻转硬币

    ID: 10412 远端评测题 3000ms 256MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2023O2优化素数判断,质数,筛法蓝桥杯省赛

[蓝桥杯 2023 省 A] 翻转硬币

Problem Description

Given nn coins placed in order. At the beginning, only the 11st coin is facing down, and all other coins are facing up. In each operation, you may choose any integer ii and flip all coins at positions jj that satisfy jmodi=0j \bmod i = 0.

Find the minimum number of operations needed to make all coins face up.

Input Format

The input consists of one line containing an integer nn.

Output Format

Output one line containing an integer, the minimum number of operations.

7
6
1131796
688042

Hint

Scale and assumptions for test cases.

For 30%30\% of the test cases, n5×106n \leq 5 \times 10^6.

For 70%70\% of the test cases, n109n \leq 10^9.

For all test cases, 1n10181 \leq n \leq 10^{18}.

Translated by ChatGPT 5