import java.util.HashSet; import java.util.Scanner; /** * JD14 求幂 * @author d3y1 */ public class Main { private static final int MOD = 1000000007; public static void main(String[] args){ Scanner in = new Scanner(System.in); while(in.hasNext()){ solution(in); } } /** * 模拟法: 数学 * * 举例子找规律 * 两种情况: * 1. a=c时 * (1) a=c=1 * 式子个数: n*n * (2) a=c>1 (2<=a=c<=n) * 式子个数: n*(n-1) * * 合计: n*n+n*(n-1) = 2*n^2-n * * 2. a!=c时 * a^b = c^d * => (i^x)^b = (i^y)^d * 遍历i, 且i^x<=n i^y<=n, 求出x和y的范围 * 遍历x和y, 求出x和y的最大公约数m(m=gcd(x,y)), 放到底数做i的指数, (i^m)^n1*b = (i^m)^n2*d * 转换成求 n1*b = n2*d 有多少种情况 * x和y的较大值除以最大公约数m得到n1(n1=max(x,y)/m) * b=(n2/n1)*d (n1>n2 b<=n d<=n) * 可见构造d为n1的倍数即可 共有n/n1个 * 等式两边可以对调 结果*2 * * 合计: (n/n1)*2 = (n/(max(x,y)/m))*2 = (n/(max(x,y)/gcd(x,y)))*2 * * @param in */ private static void solution(Scanner in){ int n = in.nextInt(); // n^2+n*(n-1) = 2*n^2-n long result = (2L*n*n-n)%MOD; HashSet<Integer> set = new HashSet<>(); for(int i=2; i*i<=n; i++){ if(set.contains(i)){ continue; } int base = i; int pow = 0; while(base <= n){ set.add(base); pow++; base *= i; } for(int x=1; x<=pow; x++){ for(int y=x+1; y<=pow; y++){ result = (result+(n/(y/gcd(x,y)))*2)%MOD; } } } System.out.println(result); } /** * 最大公约数 * @param a * @param b * @return */ private static int gcd(int a, int b){ return b>0?gcd(b,a%b):a; } }