In recreational mathematics, a Niven number in a given number base, is an integer that is divisible by the sum of its digits when written in that base. For example, in base 10, 18 is a Niven number since 18 is divisible by 1+8 = 9. Also, 12001 in base 3 is also a Niven number since the sum of the digits is 4 (which is 11 in base 3) divides 12001 (12001 = 1021 x 11). Given a base b, any number n < b is trivially a Niven number. We will ignore this case. Given a base b, and a positive integer T, find the lowest number L such that L, L+1, ..., L+T-1 are all Niven numbers but neither L-1 nor L+T are Niven numbers. Input Format: First line contains two integers, b and T Output Format: A single integer L such that L, L+1, ..., L+T-1 are all Niven numbers but neither L-1 nor L+T are Niven numbers. Constraints: 2 ≤ b ≤ 10 1 < T < 7
Answers
Answered by
2
hi can we chat I want to ask why 0 factorial is 1
Similar questions