Computer Science, asked by durgapujitha135, 12 days ago

Given a decimal number N, you need to find the number of bases 1 < b <= n such that when the number N is represented in base 'b', it ends in a zero.
Input contains only one number, N.
1 <= N <= 10000
Output Format
Output one number, the number of bases b such that when number N is represented in base b, the number contains a trailing zero.
Sample Input 0
12
Sample Output 0
5
Explanation 0
Base : Number :
2 1100
3 110
4 30
5 22
6 20
7 15
8 14
9 13
10 12
11 11
12 10
12 ends with a zero in 5 different number systems - 2,3,4,6 and 12. Hence the answer is 12.

Answers

Answered by venatisandhya0810
6

Answer:

Explanation:

c=0

n=int(input())

for i in range(2,n+1):

     if(n%i==0):

            c+=1

print(c)

Answered by ravilaccs
0

Answer:

The number one hundred and forty-three is usually denoted (in base 10) by 143. What this really stands for is $1 \times 10^{2}+4 \times 10^{1}+3 \times 10^{0}$. Its an example of our place-value system. There is a ones place, a tens place a hundred place, etc. More generally, if each $d_{i}$ stands for a digit, then $d_{k} d_{k-1} \ldots d_{1} d_{0}$ is really a shorthand for d_{k} \times 10^{k}+d_{k-1} \times 10^{k-1}+\ldots+$ $d_{1} \times 10^{1}+d_{0} \times 10^{0}$.

  • In base ten we use the digits $0,1, \ldots, 9$ (from zero up to the base minus one). But there is no real reason to use ten as the base.
  • Memorize: If $b &gt; 1$ is an integer and each $d_{i}$ is an integer between 0 and $b-1$, then the notation $\left(d_{k} d_{k-1} \ldots d_{1} d_{0}\right)_{b}$ means d_{k} \times b^{k}+d_{k-1} \times$ $b^{k-1}+\ldots+d_{1} \times b^{1}+d_{0} \times b^{0}$. If $n=d_{k} \times b^{k}+d_{k-1} \times b^{k-1}+\ldots+d_{1} \times b^{1}+d_{0} \times b^{0}$, then $\left(d_{k} d_{k-1} \ldots d_{1} d_{0}\right)_{b}$is called the base b representation of $n$.
  • If the base is bigger than 10 , then we need to use other symbols to represent the digits. For example, in hexadecimal (base 16), the letters A, B, C, D, E, and F stand for 10 through 15 , respectively.

Theorem. If $b &gt; 1$, then every integer $n$ has a unique base $b$ representation.

  • The digits of the base $b$ representation of $n$, from right to left, are the remainders on successive division by $b$. That is, if $n=b q_{0}+r_{0}, 0 \leq r &lt; b$, then$d_{0}=r_{0}$. Continuing, writing $q_{0}=b q_{1}+r_{1}, 0 \leq r &lt; b$, and $d_{1}=r_{1}$. Keep repeating the process of dividing the quotient by $b$ and taking the remainder to get the rest of the digits. To see why this works, work backward $d_{k}$.
  • Adding and multiplying in base $b$ work just like in base ten. You keep the one digit and carry the appropriate multiple of the base.
  • Multiplication in base 2 is particularly easy: it just involves shifting and adding. to make the number of bits a multiple of 4.)
  • Converting from base 16 to base 2 is equally easy: replace each hexadecimal digit with the corresponding 4-digit binary number (you have to use all 4 bits, including leading zeros).
  • Similar rules apply to convert binary to octal (base 8: one octal digit corresponds to three bits), base 4, or any other base which is a
  • power of 2. You should be able to explain in words why these shortcuts work
Similar questions