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
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
0
Answer:
The number one hundred and forty-three is usually denoted (in base 10) by 143. What this really stands for is . Its an example of our place-value system. There is a ones place, a tens place a hundred place, etc. More generally, if each stands for a digit, then is really a shorthand for
- In base ten we use the digits (from zero up to the base minus one). But there is no real reason to use ten as the base.
- Memorize: If is an integer and each is an integer between 0 and , then the notation means is called the base b representation of .
- 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 , then every integer has a unique base representation.
- The digits of the base representation of , from right to left, are the remainders on successive division by . That is, if , then. Continuing, writing , and . Keep repeating the process of dividing the quotient by and taking the remainder to get the rest of the digits. To see why this works, work backward .
- Adding and multiplying in base 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