All Tracks Math Combinatorics Inclusion-Exclusion Problem

Non-coprime sequences
Tag(s):

Hard

Problem
Editorial
Analytics

You are given two integers n, and m.

Find the number of sequences of length n such that:

  • All elements of the sequence are positive divisors of m

  • For any two adjacent elements of the sequence, say p and q, there exists at least one prime which divides both p and q

Print this number modulo \( 10^9 + 7 \)

Input
The first line of the input contains two integers, n, and m respectively.

Output
Print the number of valid sequences modulo \(10^9 + 7\)

Constraints

  • \( 1 \le n \le 10^5 \)

  • \( 1 \le m \le 10^{18} \)

SAMPLE INPUT
2 10
SAMPLE OUTPUT
7
Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

IIT Delhi

Challenge Name

ICPC de Tryst

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications

?