牛客网暑期ACM多校训练营(第三场)H Diff-prime Pairs (贡献)

链接:https://ac.nowcoder.com/acm/contest/141/H来源:牛客网

Eddy has solved lots of problem involving calculating the number of coprime pairs within some range. This problem can be solved with inclusion-exclusion method. Eddy has implemented it lots of times. Someday, when he encounters another coprime pairs problem, he comes up with diff-prime pairs problem. diff-prime pairs problem is that given N, you need to find the number of pairs (i, j), where igcd(i,j)\frac{i}{gcd(i, j)}gcd(i,j)i and jgcd(i,j)\frac{j}{gcd(i,j)}gcd(i,j)j are both prime and i ,j ≤ N. gcd(i, j) is the greatest common divisor of i and j. Prime is an integer greater than 1 and has only 2 positive divisors.

Eddy tried to solve it with inclusion-exclusion method but failed. Please help Eddy to solve this problem.

Note that pair (i1, j1) and pair (i2, j2) are considered different if i1 ≠ i2 or j1 ≠ j2.

输入描述:

Input has only one line containing a positive integer N.1 ≤ N ≤ 107

输出描述:

Output one line containing a non-negative integer indicating the number of diff-prime pairs (i,j) where i, j ≤ N

示例1

输入

[复制](javascript:void(0)

最新文章

  1. 对《分享一下自己用c++写的小地图》一文的补充
  2. 正则表达式在python中的应用
  3. 周末娱乐一下--------恶搞windows小脚本
  4. Codeforces Beta Round #5
  5. 如何通过源码生成Gatling可执行工具
  6. ArcGIS Desktop 与 Excel(转)
  7. hdoj 1166 敌兵布阵【线段树求区间最大值+单点更新】
  8. BZOJ 1801 AHOI2009 中国象棋 递归
  9. Tapestry: Obtained resource by @Inject is NULL
  10. 分考场(无向图着色问题)(dfs回溯)
  11. 解决 asp.net core 中下载 exe 文件返回 404
  12. Swagger2限定接口范围
  13. CSS让页面平滑滚动
  14. `define、parameter、localparam三者的区别(转)
  15. ubuntu下安装vmTools, 和共享文件
  16. MySQL 同一实例不同库之间表同步(Otter 应用)
  17. .Net Core使用Unity替换原生DI
  18. 利用python制作电子签名
  19. hdu 5288 OO’s Sequence(2015多校第一场第1题)枚举因子
  20. ios开发 内测包添加测试UDID

热门文章

  1. json 反序列化成键值对
  2. jstat介绍
  3. 打印格式化printf
  4. composer 添加贝宝PayPal
  5. idea设置打开文件窗口个数
  6. linux 源码安装JAVA jdk
  7. 分布式 ID
  8. shell sed -i 指定内容追加.
  9. HCIA SWITCHING&ROUTTING 笔记——第一章 TCP/IP基础知识(1)
  10. Git学习(一)——熟悉git操作流程