PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000260. Riemann và Mertens (Riemann vs Mertens)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Riemann và Mertens (Riemann vs Mertens)

Riemann vs Mertens

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

The Möbius function satisfies μ(1)=1\mu(1)=1, equals 00 when nn is divisible by a prime square, and otherwise equals (−1)r(-1)^r, where rr counts the distinct prime factors of nn. The Mertens function is M(n)=∑i=1nμ(i)M(n)=\sum_{i=1}^{n}\mu(i). Determine both values at nn.

Input

Read one integer nn.

Output

Print three right-aligned fields on one line: nn, μ(n)\mu(n) and M(n)M(n), each with width 8 and without additional separators.

Subtasks

  • Subtask 1 (20 points): 1≤n≤1001\le n\le 100.
  • Subtask 2 (30 points): 1≤n≤100001\le n\le 10000.
  • Subtask 3 (50 points): 1≤n≤10000001\le n\le 1000000.

Examples

Example 1

Input

20

Output

      20       0      -3

Explanation

The factorization is 20=2⋅2⋅520=2\cdot2\cdot5. Thus μ(20)=0\mu(20)=0, and summing μ(i)\mu(i) for 1≤i≤201\le i\le 20 gives M(20)=−3M(20)=-3.

Example 2

Input

1

Output

       1       1       1

Explanation

The factorization is 1=11=1. Thus μ(1)=1\mu(1)=1, and summing μ(i)\mu(i) for 1≤i≤11\le i\le 1 gives M(1)=1M(1)=1.

Example 3

Input

144

Output

     144       0      -1

Explanation

The factorization is 144=2⋅2⋅2⋅2⋅3⋅3144=2\cdot2\cdot2\cdot2\cdot3\cdot3. Thus μ(144)=0\mu(144)=0, and summing μ(i)\mu(i) for 1≤i≤1441\le i\le 144 gives M(144)=−1M(144)=-1.

Example 4

Input

73

Output

      73      -1      -4

Explanation

The factorization is 73=7373=73. Thus μ(73)=−1\mu(73)=-1, and summing μ(i)\mu(i) for 1≤i≤731\le i\le 73 gives M(73)=−4M(73)=-4.