#Lutece1477. Magic boy Bi Luo with his excited gcd problem
Magic boy Bi Luo with his excited gcd problem
Migrated from Lutece 1477 Magic boy Bi Luo with his excited gcd problem
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
As we know, Bi Luo is a magic boy, he always has some excited questions , now a new question comes.
You are given a unknow sequence , each of its element is belong to , you may easy to caculate there are different sequences.
But Bi Luo is also a powerful wizard, but these years, he just do a little bit of work,he now wants to break this bad situation. he find the key to break the situation is to find the number of different excited sequences among all of the possible sequences of . But Bi Luo now is busy in fighting at Highway 66. so this important mission is given to you. can you solve it ?
- A sequence is excited if and only if for all of its different index( ) satisfy
Input
First Line is an positive integer , ( ) , represents there are test cases.
For each test case:
The first line contains two positive integers .( , )
Output
For tht - test case , first output Case #i: , then output one integer represents the number excited sequence,because the number may be large , so you need to output the number mod .
Samples
1
5 3
Case #1: 31
Resources
“玲珑杯”ACM比赛 Round #2