Under construction

Still being built. Things may change

Algebra

Time limit5sMemory limit1024 MB

Summary
Count integer pairs (a, b) with |a|, |b| <= m such that x^n + a*x + b = 0 has exactly k distinct rational roots.
Level

Medium6 of 10

Topics
Math, Number theory, Combinatorics
Solved
No attempts yet

Problem

Given three integers nn, mm, and kk, find the number of pairs (a,b)(a, b) that satisfy all of the following conditions.

  • ∣a∣,∣b∣≤m|a|, |b| \leq m
  • a,b∈Za, b \in \mathbb{Z}, that is, aa and bb are integers
  • ∣S∣=k|S| = k, where SS is the set of rational roots of the equation xn+a⋅x+b=0x^n + a \cdot x + b = 0 and ∣S∣|S| is the size of SS. In other words, the equation has exactly kk distinct rational numbers xx as solutions.

A number xx is rational if and only if there exist integers pp and qq with q≠0q \neq 0 such that x=pqx = \frac{p}{q}.

Input

The input consists of several test cases, terminated by end-of-file. The first line of each test case contains three integers nn, mm, and kk.

Output

For each test case, output one integer, the number of pairs.

Constraints

  • 1≤n,m,k≤5×1051 \leq n, m, k \leq 5 \times 10^5
  • In each input, the sum of mm does not exceed 5×1055 \times 10^5.

Hint

For the first test case, only the equation x2=0x^2=0 has one rational root.

For the second test case, each of the following 7 equations has two distinct rational roots: x2−2x=0x^2-2x=0, x2−x=0x^2-x=0, x2−x−2=0x^2-x-2=0, x2−1=0x^2-1=0, x2+x=0x^2+x=0, x2+2x=0x^2+2x=0, x2+x−2=0x^2+x-2=0.

Examples1

  1. Example 1

    Input
    2 1 1
    2 2 2
    3 3 3
    
    Expected output
    1
    7
    1