Number starting with 1 in b-base
Submissions: 190   Accuracy:

21.07%

  Difficulty: Easy   Marks: 2

Given a number N and base b if N in base b representation starts with 1 print Yes else print No

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow Each test case contaisn two integers N and b denoting the integer and base respectively.

Output:
Print "Yes"(without quotes) if N in base b representation starts with 1 else print "No" ( without quotes).

Constraints:
1<=T<=100
1<=N,b<=100

Example:
Input:

4
6 4
24 2
24 7
24 15

Output:
Yes
Yes
No
Yes

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Govil
Author: Ayush Govil 1


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.