there are several special numbers in the numerology 1 Such number is the Rubi number Rubi number are the one with no consecutive zero in them given to positive integer n and K find the total number of Ruby numbers that can be formed with only have n digits and the digits of the number lie in the set {0,1,2....k-1}
Answers
Answer:
sorry I don't know the answer I am very sorry
Answer:
Following Python program performs the desired work. Just copy and paste the code into any Python IDE.
Explanation:
def check_consecutive_zero(N, K):
my_result = convert_to_base(N, K)
if (check_n(my_result)):
print("Yes")
else:
print("No")
def convert_to_base(N, K):
weight = 1
s = 0
while (N != 0):
r = N % K
N = N//K
s = r * weight + s
weight*= 10
return s
def check_n(N):
res = False
while (N != 0):
r = N % 10
N = N//10
if (res == True and r == 0):
return False
if (r > 0):
res = False
continue
res = True
return True
N = int(input())
K = int(input())
print("Does the number have consecutive zeroes in the base ?")
check_consecutive_zero(N, K)
#SPJ3